// source --> https://www.responsenet.org/wp-content/plugins/events-manager/includes/js/events-manager.js?ver=5.973 jQuery(document).ready( function($){ var load_ui_css = false; //load jquery ui css? /* Time Entry */ $('#start-time').each(function(i, el){ $(el).addClass('em-time-input em-time-start').next('#end-time').addClass('em-time-input em-time-end').parent().addClass('em-time-range'); }); if( $(".em-time-input").length > 0 ){ em_setup_timepicker('body'); } /* Calendar AJAX */ $('.em-calendar-wrapper a').off("click"); $('.em-calendar-wrapper').on('click', 'a.em-calnav, a.em-calnav', function(e){ e.preventDefault(); $(this).closest('.em-calendar-wrapper').prepend('
'); var url = em_ajaxify($(this).attr('href')); $(this).closest('.em-calendar-wrapper').load(url, function(){$(this).trigger('em_calendar_load');}); } ); //Events Search $(document).on('click change', '.em-toggle', function(e){ e.preventDefault(); //show or hide advanced tickets, hidden by default var el = $(this); var rel = el.attr('rel').split(':'); if( el.hasClass('show-search') ){ if( rel.length > 1 ){ el.closest(rel[1]).find(rel[0]).slideUp(); } else{ $(rel[0]).slideUp(); } el.find('.show, .show-advanced').show(); el.find('.hide, .hide-advanced').hide(); el.removeClass('show-search'); }else{ if( rel.length > 1 ){ el.closest(rel[1]).find(rel[0]).slideDown(); } else{ $(rel[0]).slideDown(); } el.find('.show, .show-advanced').hide(); el.find('.hide, .hide-advanced').show(); el.addClass('show-search'); } }); if( EM.search_term_placeholder ){ if( 'placeholder' in document.createElement('input') ){ $('input.em-events-search-text, input.em-search-text').attr('placeholder', EM.search_term_placeholder); }else{ $('input.em-events-search-text, input.em-search-text').blur(function(){ if( this.value=='' ) this.value = EM.search_term_placeholder; }).focus(function(){ if( this.value == EM.search_term_placeholder ) this.value=''; }).trigger('blur'); } } $('.em-search-form select[name=country]').change( function(){ var el = $(this); $('.em-search select[name=state]').html(''); $('.em-search select[name=region]').html(''); $('.em-search select[name=town]').html(''); if( el.val() != '' ){ el.closest('.em-search-location').find('.em-search-location-meta').slideDown(); var data = { action : 'search_states', country : el.val(), return_html : true }; $('.em-search select[name=state]').load( EM.ajaxurl, data ); data.action = 'search_regions'; $('.em-search select[name=region]').load( EM.ajaxurl, data ); data.action = 'search_towns'; $('.em-search select[name=town]').load( EM.ajaxurl, data ); }else{ el.closest('.em-search-location').find('.em-search-location-meta').slideUp(); } }); $('.em-search-form select[name=region]').change( function(){ $('.em-search select[name=state]').html(''); $('.em-search select[name=town]').html(''); var data = { action : 'search_states', region : $(this).val(), country : $('.em-search-form select[name=country]').val(), return_html : true }; $('.em-search select[name=state]').load( EM.ajaxurl, data ); data.action = 'search_towns'; $('.em-search select[name=town]').load( EM.ajaxurl, data ); }); $('.em-search-form select[name=state]').change( function(){ $('.em-search select[name=town]').html(''); var data = { action : 'search_towns', state : $(this).val(), region : $('.em-search-form select[name=region]').val(), country : $('.em-search-form select[name=country]').val(), return_html : true }; $('.em-search select[name=town]').load( EM.ajaxurl, data ); }); //in order for this to work, you need the above classes to be present in your templates $(document).on('submit', '.em-search-form, .em-events-search-form', function(e){ var form = $(this); if( this.em_search && this.em_search.value == EM.txt_search){ this.em_search.value = ''; } var results_wrapper = form.closest('.em-search-wrapper').find('.em-search-ajax'); if( results_wrapper.length == 0 ) results_wrapper = $('.em-search-ajax'); if( results_wrapper.length > 0 ){ results_wrapper.append('
'); var submitButton = form.find('.em-search-submit'); submitButton.data('buttonText', submitButton.val()).val(EM.txt_searching); var img = submitButton.children('img'); if( img.length > 0 ) img.attr('src', img.attr('src').replace('search-mag.png', 'search-loading.gif')); var vars = form.serialize(); $.ajax( EM.ajaxurl, { type : 'POST', dataType : 'html', data : vars, success : function(responseText){ submitButton.val(submitButton.data('buttonText')); if( img.length > 0 ) img.attr('src', img.attr('src').replace('search-loading.gif', 'search-mag.png')); results_wrapper.replaceWith(responseText); if( form.find('input[name=em_search]').val() == '' ){ form.find('input[name=em_search]').val(EM.txt_search); } //reload results_wrapper results_wrapper = form.closest('.em-search-wrapper').find('.em-search-ajax'); if( results_wrapper.length == 0 ) results_wrapper = $('.em-search-ajax'); jQuery(document).triggerHandler('em_search_ajax', [vars, results_wrapper, e]); //ajax has loaded new results } }); e.preventDefault(); return false; } }); if( $('.em-search-ajax').length > 0 ){ $(document).on('click', '.em-search-ajax a.page-numbers', function(e){ var a = $(this); var data = a.closest('.em-pagination').attr('data-em-ajax'); var wrapper = a.closest('.em-search-ajax'); var wrapper_parent = wrapper.parent(); var qvars = a.attr('href').split('?'); var vars = qvars[1]; //add data-em-ajax att if it exists if( data != '' ){ vars = vars != '' ? vars+'&'+data : data; } wrapper.append('
'); $.ajax( EM.ajaxurl, { type : 'POST', dataType : 'html', data : vars, success : function(responseText) { wrapper.replaceWith(responseText); wrapper = wrapper_parent.find('.em-search-ajax'); jQuery(document).triggerHandler('em_search_ajax', [vars, wrapper, e]); //ajax has loaded new results } }); e.preventDefault(); return false; }); } /* * ADMIN AREA AND PUBLIC FORMS (Still polishing this section up, note that form ids and classes may change accordingly) */ //Events List //Approve/Reject Links $('.events-table').on('click', '.em-event-delete', function(){ if( !confirm("Are you sure you want to delete?") ){ return false; } window.location.href = this.href; }); //Forms $('#event-form #event-image-delete, #location-form #location-image-delete').on('click', function(){ var el = $(this); if( el.is(':checked') ){ el.closest('.event-form-image, .location-form-image').find('#event-image-img, #location-image-img').hide(); }else{ el.closest('.event-form-image, .location-form-image').find('#event-image-img, #location-image-img').show(); } }); //Event Editor //Recurrence Warnings $('#event-form.em-event-admin-recurring').submit( function(event){ var form = $(this); if( form.find('input[name="event_reschedule"]').first().val() == 1 ){ var warning_text = EM.event_reschedule_warning; }else if( form.find('input[name="event_recreate_tickets"]').first().val() == 1 ){ var warning_text = EM.event_recurrence_bookings; }else{ var warning_text = EM.event_recurrence_overwrite; } confirmation = confirm(warning_text); if( confirmation == false ){ event.preventDefault(); } }); //Buttons for recurrence warnings within event editor forms $('.em-reschedule-trigger').click(function(e){ e.preventDefault(); var trigger = $(this); trigger.closest('.em-recurrence-reschedule').find(trigger.data('target')).removeClass('reschedule-hidden'); trigger.siblings('.em-reschedule-value').val(1); trigger.addClass('reschedule-hidden').siblings('a').removeClass('reschedule-hidden'); }); $('.em-reschedule-cancel').click(function(e){ e.preventDefault(); var trigger = $(this); trigger.closest('.em-recurrence-reschedule').find(trigger.data('target')).addClass('reschedule-hidden'); trigger.siblings('.em-reschedule-value').val(0); trigger.addClass('reschedule-hidden').siblings('a').removeClass('reschedule-hidden'); }); //Tickets & Bookings if( $("#em-tickets-form").length > 0 ){ //Enable/Disable Bookings $('#event-rsvp').click( function(event){ if( !this.checked ){ confirmation = confirm(EM.disable_bookings_warning); if( confirmation == false ){ event.preventDefault(); }else{ $('#event-rsvp-options').hide(); } }else{ $('#event-rsvp-options').fadeIn(); } }); if($('input#event-rsvp').is(":checked")) { $("div#rsvp-data").fadeIn(); } else { $("div#rsvp-data").hide(); } //Ticket(s) UI var reset_ticket_forms = function(){ $('#em-tickets-form table tbody tr.em-tickets-row').show(); $('#em-tickets-form table tbody tr.em-tickets-row-form').hide(); }; //recurrences and cut-off logic for ticket availability if( $('#em-recurrence-checkbox').length > 0 ){ $('#em-recurrence-checkbox').change(function(){ if( $('#em-recurrence-checkbox').is(':checked') ){ $('#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring').show(); $('#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden').hide(); }else{ $('#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal').show(); $('#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden').hide(); } }).trigger('change'); }else if( $('#em-form-recurrence').length > 0 ){ $('#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring').show(); $('#em-tickets-form .ticket-dates-from-normal, #em-tickets-form .ticket-dates-to-normal, #event-rsvp-options .em-booking-date-normal, #em-tickets-form .hidden').hide(); }else{ $('#em-tickets-form .ticket-dates-from-recurring, #em-tickets-form .ticket-dates-to-recurring, #event-rsvp-options .em-booking-date-recurring, #em-tickets-form .hidden').hide(); } //Add a new ticket $("#em-tickets-add").click(function(e){ e.preventDefault(); reset_ticket_forms(); //create copy of template slot, insert so ready for population var tickets = $('#em-tickets-form table tbody'); var rowNo = tickets.length+1; var slot = tickets.first('.em-ticket-template').clone(true).attr('id','em-ticket-'+ rowNo).removeClass('em-ticket-template').addClass('em-ticket').appendTo($('#em-tickets-form table')); //change the index of the form element names slot.find('*[name]').each( function(index,el){ el = $(el); el.attr('name', el.attr('name').replace('em_tickets[0]','em_tickets['+rowNo+']')); }); //show ticket and switch to editor slot.show().find('.ticket-actions-edit').trigger('click'); //refresh datepicker and values slot.find('.em-date-input-loc').datepicker('destroy').removeAttr('id'); //clear all datepickers slot.find('.em-time-input').unbind().each(function(index, el){ this.timePicker = false; }); //clear all timepickers - consequently, also other click/blur/change events, recreate the further down em_setup_datepicker(slot); em_setup_timepicker(slot); $('html, body').animate({ scrollTop: slot.offset().top - 30 }); //sends user to form check_ticket_sortability(); }); //Edit a Ticket $(document).on('click', '.ticket-actions-edit', function(e){ e.preventDefault(); reset_ticket_forms(); var tbody = $(this).closest('tbody'); tbody.find('tr.em-tickets-row').hide(); tbody.find('tr.em-tickets-row-form').fadeIn(); return false; }); $(document).on('click', '.ticket-actions-edited', function(e){ e.preventDefault(); var tbody = $(this).closest('tbody'); var rowNo = tbody.attr('id').replace('em-ticket-',''); tbody.find('.em-tickets-row').fadeIn(); tbody.find('.em-tickets-row-form').hide(); tbody.find('*[name]').each(function(index,el){ el = $(el); if( el.attr('name') == 'ticket_start_pub'){ tbody.find('span.ticket_start').text(el.attr('value')); }else if( el.attr('name') == 'ticket_end_pub' ){ tbody.find('span.ticket_end').text(el.attr('value')); }else if( el.attr('name') == 'em_tickets['+rowNo+'][ticket_type]' ){ if( el.find(':selected').val() == 'members' ){ tbody.find('span.ticket_name').prepend('* '); } }else if( el.attr('name') == 'em_tickets['+rowNo+'][ticket_start_recurring_days]' ){ var text = tbody.find('select.ticket-dates-from-recurring-when').val() == 'before' ? '-'+el.attr('value'):el.attr('value'); if( el.attr('value') != '' ){ tbody.find('span.ticket_start_recurring_days').text(text); tbody.find('span.ticket_start_recurring_days_text, span.ticket_start_time').removeClass('hidden').show(); }else{ tbody.find('span.ticket_start_recurring_days').text(' - '); tbody.find('span.ticket_start_recurring_days_text, span.ticket_start_time').removeClass('hidden').hide(); } }else if( el.attr('name') == 'em_tickets['+rowNo+'][ticket_end_recurring_days]' ){ var text = tbody.find('select.ticket-dates-to-recurring-when').val() == 'before' ? '-'+el.attr('value'):el.attr('value'); if( el.attr('value') != '' ){ tbody.find('span.ticket_end_recurring_days').text(text); tbody.find('span.ticket_end_recurring_days_text, span.ticket_end_time').removeClass('hidden').show(); }else{ tbody.find('span.ticket_end_recurring_days').text(' - '); tbody.find('span.ticket_end_recurring_days_text, span.ticket_end_time').removeClass('hidden').hide(); } }else{ tbody.find('.'+el.attr('name').replace('em_tickets['+rowNo+'][','').replace(']','').replace('[]','')).text(el.attr('value')); } }); //allow for others to hook into this $(document).triggerHandler('em_maps_tickets_edit', [tbody, rowNo, true]); $('html, body').animate({ scrollTop: tbody.parent().offset().top - 30 }); //sends user back to top of form return false; }); $(document).on('change', '.em-ticket-form select.ticket_type', function(e){ //check if ticket is for all users or members, if members, show roles to limit the ticket to var el = $(this); if( el.find('option:selected').val() == 'members' ){ el.closest('.em-ticket-form').find('.ticket-roles').fadeIn(); }else{ el.closest('.em-ticket-form').find('.ticket-roles').hide(); } }); $(document).on('click', '.em-ticket-form .ticket-options-advanced', function(e){ //show or hide advanced tickets, hidden by default e.preventDefault(); var el = $(this); if( el.hasClass('show') ){ el.closest('.em-ticket-form').find('.em-ticket-form-advanced').fadeIn(); el.find('.show,.show-advanced').hide(); el.find('.hide,.hide-advanced').show(); }else{ el.closest('.em-ticket-form').find('.em-ticket-form-advanced').hide(); el.find('.show,.show-advanced').show(); el.find('.hide,.hide-advanced').hide(); } el.toggleClass('show'); }); $('.em-ticket-form').each( function(){ //check whether to show advanced options or not by default for each ticket var show_advanced = false; var el = $(this); el.find('.em-ticket-form-advanced input[type="text"]').each(function(){ if(this.value != '') show_advanced = true; }); if( el.find('.em-ticket-form-advanced input[type="checkbox"]:checked').length > 0 ){ show_advanced = true; } el.find('.em-ticket-form-advanced option:selected').each(function(){ if(this.value != '') show_advanced = true; }); if( show_advanced ) el.find('.ticket-options-advanced').trigger('click'); }); //Delete a ticket $(document).on('click', '.ticket-actions-delete', function(e){ e.preventDefault(); var el = $(this); var tbody = el.closest('tbody'); if( tbody.find('input.ticket_id').val() > 0 ){ //only will happen if no bookings made el.text('Deleting...'); $.getJSON( $(this).attr('href'), {'em_ajax_action':'delete_ticket', 'id':tbody.find('input.ticket_id').val()}, function(data){ if(data.result){ tbody.remove(); }else{ el.text('Delete'); alert(data.error); } }); }else{ //not saved to db yet, so just remove tbody.remove(); } check_ticket_sortability(); return false; }); //Sort Tickets $('#em-tickets-form.em-tickets-sortable table').sortable({ items: '> tbody', placeholder: "em-ticket-sortable-placeholder", handle:'.ticket-status', helper: function( event, el ){ var helper = $(el).clone().addClass('em-ticket-sortable-helper'); var tds = helper.find('.em-tickets-row td').length; helper.children().remove(); helper.append(''); return helper; }, }); var check_ticket_sortability = function(){ var em_tickets = $('#em-tickets-form table tbody.em-ticket'); if( em_tickets.length == 1 ){ em_tickets.find('.ticket-status').addClass('single'); $('#em-tickets-form.em-tickets-sortable table').sortable( "option", "disabled", true ); }else{ em_tickets.find('.ticket-status').removeClass('single'); $('#em-tickets-form.em-tickets-sortable table').sortable( "option", "disabled", false ); } }; check_ticket_sortability(); } //Manageing Bookings if( $('#em-bookings-table').length > 0 ){ //Pagination link clicks $(document).on('click', '#em-bookings-table .tablenav-pages a', function(){ var el = $(this); var form = el.parents('#em-bookings-table form.bookings-filter'); //get page no from url, change page, submit form var match = el.attr('href').match(/#[0-9]+/); if( match != null && match.length > 0){ var pno = match[0].replace('#',''); form.find('input[name=pno]').val(pno); }else{ form.find('input[name=pno]').val(1); } form.trigger('submit'); return false; }); //Overlay Options var em_bookings_settings_dialog = { modal : true, autoOpen: false, minWidth: 500, height: 'auto', buttons: [{ text: EM.bookings_settings_save, click: function(e){ e.preventDefault(); //we know we'll deal with cols, so wipe hidden value from main var match = $("#em-bookings-table form.bookings-filter [name=cols]").val(''); var booking_form_cols = $('form#em-bookings-table-settings-form input.em-bookings-col-item'); $.each( booking_form_cols, function(i,item_match){ //item_match = $(item_match); if( item_match.value == 1 ){ if( match.val() != ''){ match.val(match.val()+','+item_match.name); }else{ match.val(item_match.name); } } }); //submit main form $('#em-bookings-table-settings').trigger('submitted'); //hook into this with bind() $('#em-bookings-table form.bookings-filter').trigger('submit'); $(this).dialog('close'); } }] }; var em_bookings_export_dialog = { modal : true, autoOpen: false, minWidth: 500, height: 'auto', buttons: [{ text: EM.bookings_export_save, click: function(e){ $(this).children('form').submit(); $(this).dialog('close'); } }] }; if( $("#em-bookings-table-settings").length > 0 ){ //Settings Overlay $("#em-bookings-table-settings").dialog(em_bookings_settings_dialog); $(document).on('click', '#em-bookings-table-settings-trigger', function(e){ e.preventDefault(); $("#em-bookings-table-settings").dialog('open'); }); //Export Overlay $("#em-bookings-table-export").dialog(em_bookings_export_dialog); $(document).on('click', '#em-bookings-table-export-trigger', function(e){ e.preventDefault(); $("#em-bookings-table-export").dialog('open'); }); var export_overlay_show_tickets = function(){ if( $('#em-bookings-table-export-form input[name=show_tickets]').is(':checked') ){ $('#em-bookings-table-export-form .em-bookings-col-item-ticket').show(); $('#em-bookings-table-export-form #em-bookings-export-cols-active .em-bookings-col-item-ticket input').val(1); }else{ $('#em-bookings-table-export-form .em-bookings-col-item-ticket').hide().find('input').val(0); } }; //Sync export overlay with table search field changes $('#em-bookings-table form select').each(function(i, el){ $(el).change(function(e){ var select_el = $(this); var input_par = $('#em-bookings-table-export-form input[name='+select_el.attr('name')+']'); var input_par_selected = select_el.find('option:selected'); input_par.val(input_par_selected.val()); }); }); export_overlay_show_tickets(); $('#em-bookings-table-export-form input[name=show_tickets]').click(export_overlay_show_tickets); //Sortables $( ".em-bookings-cols-sortable" ).sortable({ connectWith: ".em-bookings-cols-sortable", update: function(event, ui) { if( ui.item.parents('ul#em-bookings-cols-active, ul#em-bookings-export-cols-active').length > 0 ){ ui.item.addClass('ui-state-highlight').removeClass('ui-state-default').children('input').val(1); }else{ ui.item.addClass('ui-state-default').removeClass('ui-state-highlight').children('input').val(0); } } }).disableSelection(); load_ui_css = true; } //Widgets and filter submissions $(document).on('submit', '#em-bookings-table form.bookings-filter', function(e){ var el = $(this); //append loading spinner el.parents('#em-bookings-table').find('.table-wrap').first().append('
'); //ajax call $.post( EM.ajaxurl, el.serializeArray(), function(data){ var root = el.parents('#em-bookings-table').first(); root.replaceWith(data); //recreate overlays $('#em-bookings-table-export input[name=scope]').val(root.find('select[name=scope]').val()); $('#em-bookings-table-export input[name=status]').val(root.find('select[name=status]').val()); jQuery(document).triggerHandler('em_bookings_filtered', [data, root, el]); }); return false; }); //Approve/Reject Links $(document).on('click', '.em-bookings-approve,.em-bookings-reject,.em-bookings-unapprove,.em-bookings-delete', function(){ var el = $(this); if( el.hasClass('em-bookings-delete') ){ if( !confirm(EM.booking_delete) ){ return false; } } var url = em_ajaxify( el.attr('href')); var td = el.parents('td').first(); td.html(EM.txt_loading); td.load( url ); return false; }); } //Old Bookings Table - depreciating soon if( $('.em_bookings_events_table').length > 0 ){ //Widgets and filter submissions $(document).on('submit', '.em_bookings_events_table form', function(e){ var el = $(this); var url = em_ajaxify( el.attr('action') ); el.parents('.em_bookings_events_table').find('.table-wrap').first().append('
'); $.get( url, el.serializeArray(), function(data){ el.parents('.em_bookings_events_table').first().replaceWith(data); }); return false; }); //Pagination link clicks $(document).on('click', '.em_bookings_events_table .tablenav-pages a', function(){ var el = $(this); var url = em_ajaxify( el.attr('href') ); el.parents('.em_bookings_events_table').find('.table-wrap').first().append('
'); $.get( url, function(data){ el.parents('.em_bookings_events_table').first().replaceWith(data); }); return false; }); } //Manual Booking $(document).on('click', 'a.em-booking-button', function(e){ e.preventDefault(); var button = $(this); if( button.text() != EM.bb_booked && $(this).text() != EM.bb_booking){ button.text(EM.bb_booking); var button_data = button.attr('id').split('_'); $.ajax({ url: EM.ajaxurl, dataType: 'jsonp', data: { event_id : button_data[1], _wpnonce : button_data[2], action : 'booking_add_one' }, success : function(response, statusText, xhr, $form) { if(response.result){ button.text(EM.bb_booked); }else{ button.text(EM.bb_error); } if(response.message != '') alert(response.message); }, error : function(){ button.text(EM.bb_error); } }); } return false; }); $(document).on('click', 'a.em-cancel-button', function(e){ e.preventDefault(); var button = $(this); if( button.text() != EM.bb_cancelled && button.text() != EM.bb_canceling){ button.text(EM.bb_canceling); var button_data = button.attr('id').split('_'); $.ajax({ url: EM.ajaxurl, dataType: 'jsonp', data: { booking_id : button_data[1], _wpnonce : button_data[2], action : 'booking_cancel' }, success : function(response, statusText, xhr, $form) { if(response.result){ button.text(EM.bb_cancelled); }else{ button.text(EM.bb_cancel_error); } }, error : function(){ button.text(EM.bb_cancel_error); } }); } return false; }); //Datepicker if( $('.em-date-single, .em-date-range, #em-date-start').length > 0 ){ load_ui_css = true; em_setup_datepicker('body'); } if( load_ui_css ) em_load_jquery_css(); //previously in em-admin.php function updateIntervalDescriptor () { $(".interval-desc").hide(); var number = "-plural"; if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "") number = "-singular"; var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number; $(descriptor).show(); } function updateIntervalSelectors () { $('p.alternate-selector').hide(); $('p#'+ $('select#recurrence-frequency').val() + "-selector").show(); } function updateShowHideRecurrence () { if( $('input#event-recurrence').is(":checked")) { $("#event_recurrence_pattern").fadeIn(); $("#event-date-explanation").hide(); $("#recurrence-dates-explanation").show(); $("h3#recurrence-dates-title").show(); $("h3#event-date-title").hide(); } else { $("#event_recurrence_pattern").hide(); $("#recurrence-dates-explanation").hide(); $("#event-date-explanation").show(); $("h3#recurrence-dates-title").hide(); $("h3#event-date-title").show(); } } $("#recurrence-dates-explanation").hide(); $("#date-to-submit").hide(); $("#end-date-to-submit").hide(); $("#localised-date").show(); $("#localised-end-date").show(); $('#em-wrapper input.select-all').change(function(){ if($(this).is(':checked')){ $('input.row-selector').prop('checked', true); $('input.select-all').prop('checked', true); }else{ $('input.row-selector').prop('checked', false); $('input.select-all').prop('checked', false); } }); updateIntervalDescriptor(); updateIntervalSelectors(); updateShowHideRecurrence(); $('input#event-recurrence').change(updateShowHideRecurrence); // recurrency elements $('input#recurrence-interval').keyup(updateIntervalDescriptor); $('select#recurrence-frequency').change(updateIntervalDescriptor); $('select#recurrence-frequency').change(updateIntervalSelectors); /* Load any maps */ if( $('.em-location-map').length > 0 || $('.em-locations-map').length > 0 || $('#em-map').length > 0 || $('.em-search-geo').length > 0 ){ em_maps_load(); } //Finally, add autocomplete here //Autocomplete if( jQuery( "div.em-location-data input#location-name" ).length > 0 ){ jQuery( "div.em-location-data input#location-name" ).autocomplete({ source: EM.locationajaxurl, minLength: 2, focus: function( event, ui ){ jQuery("input#location-id" ).val( ui.item.value ); return false; }, select: function( event, ui ){ jQuery("input#location-id" ).val(ui.item.id).trigger('change'); jQuery("input#location-name" ).val(ui.item.value); jQuery('input#location-address').val(ui.item.address); jQuery('input#location-town').val(ui.item.town); jQuery('input#location-state').val(ui.item.state); jQuery('input#location-region').val(ui.item.region); jQuery('input#location-postcode').val(ui.item.postcode); jQuery('input#location-latitude').val(ui.item.latitude); jQuery('input#location-longitude').val(ui.item.longitude); if( ui.item.country == '' ){ jQuery('select#location-country option:selected').removeAttr('selected'); }else{ jQuery('select#location-country option[value="'+ui.item.country+'"]').attr('selected', 'selected'); } jQuery('div.em-location-data input, div.em-location-data select').css('background-color','#ccc').prop('readonly', true); jQuery('#em-location-reset').show(); jQuery('#em-location-search-tip').hide(); jQuery(document).triggerHandler('em_locations_autocomplete_selected', [event, ui]); return false; } }).data( "ui-autocomplete" )._renderItem = function( ul, item ) { html_val = "" + em_esc_attr(item.label) + '
'+ em_esc_attr(item.address) + ', ' + em_esc_attr(item.town)+"
"; return jQuery( "
  • " ).data( "item.autocomplete", item ).append(html_val).appendTo( ul ); }; jQuery('#em-location-reset a').click( function(){ jQuery('div.em-location-data input').css('background-color','#fff').val('').prop('readonly', false); jQuery('div.em-location-data select').css('background-color','#fff'); jQuery('div.em-location-data option:selected').removeAttr('selected'); jQuery('input#location-id').val(''); jQuery('#em-location-reset').hide(); jQuery('#em-location-search-tip').show(); jQuery('#em-map').hide(); jQuery('#em-map-404').show(); if(typeof(marker) !== 'undefined'){ marker.setPosition(new google.maps.LatLng(0, 0)); infoWindow.close(); marker.setDraggable(true); } return false; }); if( jQuery('input#location-id').val() != '0' && jQuery('input#location-id').val() != '' ){ jQuery('div.em-location-data input, div.em-location-data select').css('background-color','#ccc').prop('readonly', true); jQuery('#em-location-reset').show(); jQuery('#em-location-search-tip').hide(); } } jQuery(document).triggerHandler('em_javascript_loaded'); }); function em_load_jquery_css(){ if( EM.ui_css && jQuery('link#jquery-ui-css').length == 0 ){ var script = document.createElement("link"); script.id = 'jquery-ui-css'; script.rel = "stylesheet"; script.href = EM.ui_css; document.body.appendChild(script); } } function em_setup_datepicker(wrap){ wrap = jQuery(wrap); //default picker vals var datepicker_vals = { altFormat: "yy-mm-dd", changeMonth: true, changeYear: true, firstDay : EM.firstDay, yearRange:'c-100:c+15' }; if( EM.dateFormat ) datepicker_vals.dateFormat = EM.dateFormat; if( EM.yearRange ) datepicker_vals.yearRange = EM.yearRange; jQuery(document).triggerHandler('em_datepicker', datepicker_vals); //apply datepickers dateDivs = wrap.find('.em-date-single, .em-date-range'); if( dateDivs.length > 0 ){ //apply datepickers to elements dateDivs.find('input.em-date-input-loc').each(function(i,dateInput){ //init the datepicker var dateInput = jQuery(dateInput); var dateValue = dateInput.nextAll('input.em-date-input').first(); var dateValue_value = dateValue.val(); dateInput.datepicker(datepicker_vals); dateInput.datepicker('option', 'altField', dateValue); //now set the value if( dateValue_value ){ var this_date_formatted = jQuery.datepicker.formatDate( EM.dateFormat, jQuery.datepicker.parseDate('yy-mm-dd', dateValue_value) ); dateInput.val(this_date_formatted); dateValue.val(dateValue_value); } //add logic for texts dateInput.change(function(){ if( jQuery(this).val() == '' ){ jQuery(this).nextAll('.em-date-input').first().val(''); } }); }); //deal with date ranges dateDivs.filter('.em-date-range').find('input.em-date-input-loc').each(function(i,dateInput){ //finally, apply start/end logic to this field dateInput = jQuery(dateInput); if( dateInput.hasClass('em-date-start') ){ dateInput.datepicker('option','onSelect', function( selectedDate ) { //get corresponding end date input, we expect ranges to be contained in .em-date-range with a start/end input element var startDate = jQuery(this); var endDate = startDate.parents('.em-date-range').find('.em-date-end').first(); var startValue = startDate.nextAll('input.em-date-input').first().val(); var endValue = endDate.nextAll('input.em-date-input').first().val(); if( startValue > endValue && endValue != '' ){ endDate.datepicker( "setDate" , selectedDate ); endDate.trigger('change'); } endDate.datepicker( "option", 'minDate', selectedDate ); }); }else if( dateInput.hasClass('em-date-end') ){ var startInput = dateInput.parents('.em-date-range').find('.em-date-start').first(); if( startInput.val() != '' ){ dateInput.datepicker('option', 'minDate', startInput.val()); } } }); } } function em_setup_timepicker(wrap){ wrap = jQuery(wrap); var timepicker_options = { show24Hours: EM.show24hours == 1, step:15 } jQuery(document).triggerHandler('em_timepicker_options', timepicker_options); wrap.find(".em-time-input").timePicker(timepicker_options); // Keep the duration between the two inputs. wrap.find(".em-time-range input.em-time-start").each( function(i, el){ jQuery(el).data('oldTime', jQuery.timePicker(el).getTime()); }).change( function() { var start = jQuery(this); var end = start.nextAll('.em-time-end'); if (end.val()) { // Only update when second input has a value. // Calculate duration. var oldTime = start.data('oldTime'); var duration = (jQuery.timePicker(end).getTime() - oldTime); var time = jQuery.timePicker(start).getTime(); if( jQuery.timePicker(end).getTime() >= oldTime ){ // Calculate and update the time in the second input. jQuery.timePicker(end).setTime(new Date(new Date(time.getTime() + duration))); } start.data('oldTime', time); } }); // Validate. wrap.find(".em-time-range input.em-time-end").change(function() { var end = jQuery(this); var start = end.prevAll('.em-time-start'); if( start.val() ){ if( jQuery.timePicker(start).getTime() > jQuery.timePicker(this).getTime() && ( jQuery('.em-date-end').val().length == 0 || jQuery('.em-date-start').val() == jQuery('.em-date-end').val() ) ) { end.addClass("error"); } else { end.removeClass("error"); } } }); //Sort out all day checkbox wrap.find('.em-time-range input.em-time-all-day').change(function(){ var allday = jQuery(this); if( allday.is(':checked') ){ allday.siblings('.em-time-input').css('background-color','#ccc'); }else{ allday.siblings('.em-time-input').css('background-color','#fff'); } }).trigger('change'); } /* Useful function for adding the em_ajax flag to a url, regardless of querystring format */ var em_ajaxify = function(url){ if ( url.search('em_ajax=0') != -1){ url = url.replace('em_ajax=0','em_ajax=1'); }else if( url.search(/\?/) != -1 ){ url = url + "&em_ajax=1"; }else{ url = url + "?em_ajax=1"; } return url; }; /* * MAP FUNCTIONS */ var em_maps_loaded = false; var maps = {}; var maps_markers = {}; var infoWindow; //loads maps script if not already loaded and executes EM maps script function em_maps_load(){ if( !em_maps_loaded ){ if ( jQuery('script#google-maps').length == 0 && ( typeof google !== 'object' || typeof google.maps !== 'object' ) ){ var script = document.createElement("script"); script.type = "text/javascript"; script.id = "google-maps"; var proto = (EM.is_ssl) ? 'https:' : 'http:'; if( typeof EM.google_maps_api !== 'undefined' ){ script.src = proto + '//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps&key='+EM.google_maps_api; }else{ script.src = proto + '//maps.google.com/maps/api/js?v=quarterly&libraries=places&callback=em_maps'; } document.body.appendChild(script); }else if( typeof google === 'object' && typeof google.maps === 'object' && !em_maps_loaded ){ em_maps(); }else if( jQuery('script#google-maps').length > 0 ){ jQuery(window).load(function(){ if( !em_maps_loaded ) em_maps(); }); //google isn't loaded so wait for page to load resources } } } //re-usable function to load global location maps function em_maps_load_locations(el){ var el = jQuery(el); var map_id = el.attr('id').replace('em-locations-map-',''); var em_data = jQuery.parseJSON( el.nextAll('.em-locations-map-coords').first().text() ); if( em_data == null ){ var em_data = jQuery.parseJSON( jQuery('#em-locations-map-coords-'+map_id).text() ); } jQuery.getJSON(document.URL, em_data , function(data){ if(data.length > 0){ //define default options and allow option for extension via event triggers var map_options = { mapTypeId: google.maps.MapTypeId.ROADMAP }; if( typeof EM.google_map_id_styles == 'object' && typeof EM.google_map_id_styles[map_id] !== 'undefined' ){ console.log(EM.google_map_id_styles[map_id]); map_options.styles = EM.google_map_id_styles[map_id]; } else if( typeof EM.google_maps_styles !== 'undefined' ){ map_options.styles = EM.google_maps_styles; } jQuery(document).triggerHandler('em_maps_locations_map_options', map_options); var marker_options = {}; jQuery(document).triggerHandler('em_maps_location_marker_options', marker_options); maps[map_id] = new google.maps.Map(el[0], map_options); maps_markers[map_id] = []; var bounds = new google.maps.LatLngBounds(); jQuery.map( data, function( location, i ){ if( !(location.location_latitude == 0 && location.location_longitude == 0) ){ var latitude = parseFloat( location.location_latitude ); var longitude = parseFloat( location.location_longitude ); var location_position = new google.maps.LatLng( latitude, longitude ); //extend the default marker options jQuery.extend(marker_options, { position: location_position, map: maps[map_id] }) var marker = new google.maps.Marker(marker_options); maps_markers[map_id].push(marker); marker.setTitle(location.location_name); var myContent = '
    '+ location.location_balloon +'
    '; em_map_infobox(marker, myContent, maps[map_id]); //extend bounds bounds.extend(new google.maps.LatLng(latitude,longitude)) } }); // Zoom in to the bounds maps[map_id].fitBounds(bounds); //Call a hook if exists jQuery(document).triggerHandler('em_maps_locations_hook', [maps[map_id], data, map_id, maps_markers[map_id]]); }else{ el.children().first().html('No locations found'); jQuery(document).triggerHandler('em_maps_locations_hook_not_found', [el]); } }); } function em_maps_load_location(el){ el = jQuery(el); var map_id = el.attr('id').replace('em-location-map-',''); em_LatLng = new google.maps.LatLng( jQuery('#em-location-map-coords-'+map_id+' .lat').text(), jQuery('#em-location-map-coords-'+map_id+' .lng').text()); //extend map and markers via event triggers var map_options = { zoom: 14, center: em_LatLng, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, gestureHandling: 'cooperative' }; if( typeof EM.google_map_id_styles == 'object' && typeof EM.google_map_id_styles[map_id] !== 'undefined' ){ console.log(EM.google_map_id_styles[map_id]); map_options.styles = EM.google_map_id_styles[map_id]; } else if( typeof EM.google_maps_styles !== 'undefined' ){ map_options.styles = EM.google_maps_styles; } jQuery(document).triggerHandler('em_maps_location_map_options', map_options); maps[map_id] = new google.maps.Map( document.getElementById('em-location-map-'+map_id), map_options); var marker_options = { position: em_LatLng, map: maps[map_id] }; jQuery(document).triggerHandler('em_maps_location_marker_options', marker_options); maps_markers[map_id] = new google.maps.Marker(marker_options); infoWindow = new google.maps.InfoWindow({ content: jQuery('#em-location-map-info-'+map_id+' .em-map-balloon').get(0) }); infoWindow.open(maps[map_id],maps_markers[map_id]); maps[map_id].panBy(40,-70); //JS Hook for handling map after instantiation //Example hook, which you can add elsewhere in your theme's JS - jQuery(document).bind('em_maps_location_hook', function(){ alert('hi');} ); jQuery(document).triggerHandler('em_maps_location_hook', [maps[map_id], infoWindow, maps_markers[map_id], map_id]); //map resize listener jQuery(window).on('resize', function(e) { google.maps.event.trigger(maps[map_id], "resize"); maps[map_id].setCenter(maps_markers[map_id].getPosition()); maps[map_id].panBy(40,-70); }); } jQuery(document).bind('em_search_ajax', function(e, vars, wrapper){ if( em_maps_loaded ){ wrapper.find('.em-location-map').each( function(index, el){ em_maps_load_location(el); } ); wrapper.find('.em-locations-map').each( function(index, el){ em_maps_load_locations(el); }); } }); //Load single maps (each map is treated as a seperate map). function em_maps() { //Find all the maps on this page and load them jQuery('.em-location-map').each( function(index, el){ em_maps_load_location(el); } ); jQuery('.em-locations-map').each( function(index, el){ em_maps_load_locations(el); } ); //Location stuff - only needed if inputs for location exist if( jQuery('select#location-select-id, input#location-address').length > 0 ){ var map, marker; //load map info var refresh_map_location = function(){ var location_latitude = jQuery('#location-latitude').val(); var location_longitude = jQuery('#location-longitude').val(); if( !(location_latitude == 0 && location_longitude == 0) ){ var position = new google.maps.LatLng(location_latitude, location_longitude); //the location coords marker.setPosition(position); var mapTitle = (jQuery('input#location-name').length > 0) ? jQuery('input#location-name').val():jQuery('input#title').val(); mapTitle = em_esc_attr(mapTitle); marker.setTitle( mapTitle ); jQuery('#em-map').show(); jQuery('#em-map-404').hide(); google.maps.event.trigger(map, 'resize'); map.setCenter(position); map.panBy(40,-55); infoWindow.setContent( '
    ' + mapTitle + '
    ' + em_esc_attr(jQuery('#location-address').val()) + '
    ' + em_esc_attr(jQuery('#location-town').val()) + '
    ' ); infoWindow.open(map, marker); jQuery(document).triggerHandler('em_maps_location_hook', [map, infoWindow, marker, 0]); } else { jQuery('#em-map').hide(); jQuery('#em-map-404').show(); } }; //Add listeners for changes to address var get_map_by_id = function(id){ if(jQuery('#em-map').length > 0){ jQuery.getJSON(document.URL,{ em_ajax_action:'get_location', id:id }, function(data){ if( data.location_latitude!=0 && data.location_longitude!=0 ){ loc_latlng = new google.maps.LatLng(data.location_latitude, data.location_longitude); marker.setPosition(loc_latlng); marker.setTitle( data.location_name ); marker.setDraggable(false); jQuery('#em-map').show(); jQuery('#em-map-404').hide(); map.setCenter(loc_latlng); map.panBy(40,-55); infoWindow.setContent( '
    '+ data.location_balloon +'
    '); infoWindow.open(map, marker); google.maps.event.trigger(map, 'resize'); jQuery(document).triggerHandler('em_maps_location_hook', [map, infoWindow, marker, 0]); }else{ jQuery('#em-map').hide(); jQuery('#em-map-404').show(); } }); } }; jQuery('#location-select-id, input#location-id').change( function(){get_map_by_id(jQuery(this).val());} ); jQuery('#location-name, #location-town, #location-address, #location-state, #location-postcode, #location-country').change( function(){ //build address if( jQuery(this).prop('readonly') === true ) return; var addresses = [ jQuery('#location-address').val(), jQuery('#location-town').val(), jQuery('#location-state').val(), jQuery('#location-postcode').val() ]; var address = ''; jQuery.each( addresses, function(i, val){ if( val != '' ){ address = ( address == '' ) ? address+val:address+', '+val; } }); if( address == '' ){ //in case only name is entered, no address jQuery('#em-map').hide(); jQuery('#em-map-404').show(); return false; } //do country last, as it's using the text version if( jQuery('#location-country option:selected').val() != 0 ){ address = ( address == '' ) ? address+jQuery('#location-country option:selected').text():address+', '+jQuery('#location-country option:selected').text(); } if( address != '' && jQuery('#em-map').length > 0 ){ geocoder.geocode( { 'address': address }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { jQuery('#location-latitude').val(results[0].geometry.location.lat()); jQuery('#location-longitude').val(results[0].geometry.location.lng()); } refresh_map_location(); }); } }); //Load map if(jQuery('#em-map').length > 0){ var em_LatLng = new google.maps.LatLng(0, 0); var map_options = { zoom: 14, center: em_LatLng, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, gestureHandling: 'cooperative' }; if( typeof EM.google_maps_styles !== 'undefined' ){ map_options.styles = EM.google_maps_styles; } map = new google.maps.Map( document.getElementById('em-map'), map_options); var marker = new google.maps.Marker({ position: em_LatLng, map: map, draggable: true }); infoWindow = new google.maps.InfoWindow({ content: '' }); var geocoder = new google.maps.Geocoder(); google.maps.event.addListener(infoWindow, 'domready', function() { document.getElementById('location-balloon-content').parentNode.style.overflow=''; document.getElementById('location-balloon-content').parentNode.parentNode.style.overflow=''; }); google.maps.event.addListener(marker, 'dragend', function() { var position = marker.getPosition(); jQuery('#location-latitude').val(position.lat()); jQuery('#location-longitude').val(position.lng()); map.setCenter(position); map.panBy(40,-55); }); if( jQuery('#location-select-id').length > 0 ){ jQuery('#location-select-id').trigger('change'); }else{ refresh_map_location(); } jQuery(document).triggerHandler('em_map_loaded', [map, infoWindow, marker]); } //map resize listener jQuery(window).on('resize', function(e) { google.maps.event.trigger(map, "resize"); map.setCenter(marker.getPosition()); map.panBy(40,-55); }); } em_maps_loaded = true; //maps have been loaded jQuery(document).triggerHandler('em_maps_loaded'); } function em_map_infobox(marker, message, map) { var iw = new google.maps.InfoWindow({ content: message }); google.maps.event.addListener(marker, 'click', function() { if( infoWindow ) infoWindow.close(); infoWindow = iw; iw.open(map,marker); }); } function em_esc_attr( str ){ if( typeof str !== 'string' ) return ''; return str.replace(//gi,'>'); } /* jQuery timePicker - http://labs.perifer.se/timedatepicker/ @ http://github.com/perifer/timePicker commit 100644 */ (function(e){function t(t,n,r,i){t.value=e(n).text();e(t).change();if(!navigator.userAgent.match(/msie/i)){t.focus()}r.hide()}function n(e,t){var n=e.getHours();var i=t.show24Hours?n:(n+11)%12+1;var s=e.getMinutes();return r(i)+t.separator+r(s)+(t.show24Hours?"":n<12?" AM":" PM")}function r(e){return(e<10?"0":"")+e}function i(e,t){return typeof e=="object"?o(e):s(e,t)}function s(e,t){if(e){var n=e.split(t.separator);var r=parseFloat(n[0]);var i=parseFloat(n[1]);if(!t.show24Hours){if(r===12&&e.indexOf("AM")!==-1){r=0}else if(r!==12&&e.indexOf("PM")!==-1){r+=12}}var s=new Date(0,0,0,r,i,0);return o(s)}return null}function o(e){e.setFullYear(2001);e.setMonth(0);e.setDate(0);return e}e.fn.timePicker=function(t){var n=e.extend({},e.fn.timePicker.defaults,t);return this.each(function(){e.timePicker(this,n)})};e.timePicker=function(t,n){var r=e(t)[0];return r.timePicker||(r.timePicker=new jQuery._timePicker(r,n))};e.timePicker.version="0.3";e._timePicker=function(r,u){var a=false;var f=false;var l=i(u.startTime,u);var c=i(u.endTime,u);var h="selected";var p="li."+h;e(r).attr("autocomplete","OFF");var d=[];var v=new Date(l);while(v<=c){d[d.length]=n(v,u);v=new Date(v.setMinutes(v.getMinutes()+u.step))}var m=e('
    ');var g=e("
      ");for(var y=0;y"+d[y]+"")}m.append(g);m.appendTo("body").hide();m.mouseover(function(){a=true}).mouseout(function(){a=false});e("li",g).mouseover(function(){if(!f){e(p,m).removeClass(h);e(this).addClass(h)}}).mousedown(function(){a=true}).click(function(){t(r,this,m,u);a=false});var b=function(){if(m.is(":visible")){return false}e("li",m).removeClass(h);var t=e(r).offset();m.css({top:t.top+r.offsetHeight,left:t.left});m.show();var i=r.value?s(r.value,u):l;var a=l.getHours()*60+l.getMinutes();var f=i.getHours()*60+i.getMinutes()-a;var p=Math.round(f/u.step);var d=o(new Date(0,0,0,0,p*u.step+a,0));d=ls+m[0].offsetHeight){m[0].scrollTop=s+a.offsetHeight}}else{i.removeClass(h);a=e("li:first",g).addClass(h)[0];m[0].scrollTop=0}return false;break;case 13:if(m.is(":visible")){var l=e(p,g)[0];t(r,l,m,u)}return false;break;case 27:m.hide();return false;break}return true});e(r).keyup(function(e){f=false});this.getTime=function(){return s(r.value,u)};this.setTime=function(t){r.value=n(i(t,u),u);e(r).change()}};e.fn.timePicker.defaults={step:30,startTime:new Date(0,0,0,0,0,0),endTime:new Date(0,0,0,23,30,0),separator:":",show24Hours:true}})(jQuery); // source --> https://www.responsenet.org/wp-content/plugins/wp-1-slider/js/jquery.fitvids.js?ver=1.2.7 /*global jQuery */ /*jshint multistr:true browser:true */ /*! * FitVids 1.0 * * Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ * * Date: Thu Sept 01 18:00:00 2011 -0500 */ (function( $ ){ "use strict"; $.fn.fitVids = function( options ) { var settings = { customSelector: null }; var div = document.createElement('div'), ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; div.className = 'fit-vids-style'; div.innerHTML = '­'; ref.parentNode.insertBefore(div,ref); if ( options ) { $.extend( settings, options ); } return this.each(function(){ var selectors = [ "iframe[src*='player.vimeo.com']", "iframe[src*='www.youtube.com']", "iframe[src*='www.kickstarter.com']", "object", "embed" ]; if (settings.customSelector) { selectors.push(settings.customSelector); } var $allVideos = $(this).find(selectors.join(',')); $allVideos.each(function(){ var $this = $(this); if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), aspectRatio = height / width; if(!$this.attr('id')){ var videoID = 'fitvid' + Math.floor(Math.random()*999999); $this.attr('id', videoID); } $this.wrap('
      ').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); $this.removeAttr('height').removeAttr('width'); }); }); }; })( jQuery ); // source --> https://www.responsenet.org/wp-content/plugins/wp-1-slider/js/jquery.bxslider.min.js?ver=1.2.7 /** * BxSlider v4.1.2 - Fully loaded, responsive content slider * http://bxslider.com * * Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com * Written while drinking Belgian ales and listening to jazz * * Released under the MIT license - http://opensource.org/licenses/MIT */ !function(t){var e={},s={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};t.fn.bxSlider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slideWidth=parseInt(o.settings.slideWidth),o.children=r.children(o.settings.slideSelector),o.children.length1||o.settings.maxSlides>1,o.carousel&&(o.settings.preloadImages="all"),o.minThreshold=o.settings.minSlides*o.settings.slideWidth+(o.settings.minSlides-1)*o.settings.slideMargin,o.maxThreshold=o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin,o.working=!1,o.controls={},o.interval=null,o.animProp="vertical"==o.settings.mode?"top":"left",o.usingCSS=o.settings.useCSS&&"fade"!=o.settings.mode&&function(){var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssPrefix=e[i].replace("Perspective","").toLowerCase(),o.animProp="-"+o.cssPrefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxSlides=o.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(o.settings.slideSelector).each(function(){t(this).data("origStyle",t(this).attr("style"))}),c()},c=function(){r.wrap('
      '),o.viewport=r.parent(),o.loader=t('
      '),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingCSS&&o.settings.easing?r.css("-"+o.cssPrefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing"),f(),o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxWidth:p()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",listStyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginRight",o.settings.slideMargin),"vertical"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginBottom",o.settings.slideMargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zIndex:0,display:"none"}),o.children.eq(o.settings.startSlide).css({zIndex:o.settings.slideZIndex,display:"block"})),o.controls.el=t('
      '),o.settings.captions&&P(),o.active.last=o.settings.startSlide==x()-1,o.settings.video&&r.fitVids();var e=o.children.eq(o.settings.startSlide);"all"==o.settings.preloadImages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&T(),o.settings.controls&&C(),o.settings.auto&&o.settings.autoControls&&E(),(o.settings.controls||o.settings.autoControls||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return i(),void 0;var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteLoop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minSlides:o.settings.maxSlides,i=o.children.slice(0,e).clone().addClass("bx-clone"),s=o.children.slice(-e).clone().addClass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),S(),"vertical"==o.settings.mode&&(o.settings.adaptiveHeight=!0),o.viewport.height(v()),r.redrawSlider(),o.settings.onSliderLoad(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",Z),o.settings.auto&&o.settings.autoStart&&H(),o.settings.ticker&&L(),o.settings.pager&&q(o.settings.startSlide),o.settings.controls&&W(),o.settings.touchEnabled&&!o.settings.ticker&&O()},v=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveHeight)if(o.carousel){var n=1==o.settings.moveSlides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxSlides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(){e+=t(this).outerHeight()}),o.settings.slideMargin>0&&(e+=o.settings.slideMargin*(o.settings.minSlides-1))):e=Math.max.apply(Math,s.map(function(){return t(this).outerHeight(!1)}).get()),e},p=function(){var t="100%";return o.settings.slideWidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin:o.settings.slideWidth),t},u=function(){var t=o.settings.slideWidth,e=o.viewport.width();return 0==o.settings.slideWidth||o.settings.slideWidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxSlides>1&&"horizontal"==o.settings.mode&&(e>o.maxThreshold||e0)if(o.viewport.width()o.maxThreshold)t=o.settings.maxSlides;else{var e=o.children.first().width();t=Math.floor(o.viewport.width()/e)}else"vertical"==o.settings.mode&&(t=o.settings.minSlides);return t},x=function(){var t=0;if(o.settings.moveSlides>0)if(o.settings.infiniteLoop)t=o.children.length/m();else for(var e=0,i=0;e0&&o.settings.moveSlides<=f()?o.settings.moveSlides:f()},S=function(){if(o.children.length>o.settings.maxSlides&&o.active.last&&!o.settings.infiniteLoop){if("horizontal"==o.settings.mode){var t=o.children.last(),e=t.position();b(-(e.left-(o.viewport.width()-t.width())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minSlides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingCSS){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),D()})):"reset"==e?r.css(o.animProp,n):"ticker"==e&&(r.css("-"+o.cssPrefix+"-transition-timing-function","linear"),r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),b(s.resetValue,"reset",0),N()}))}else{var a={};a[o.animProp]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){D()}):"reset"==e?r.css(o.animProp,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetValue,"reset",0),N()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildPager&&t.isFunction(o.settings.buildPager)?(n=o.settings.buildPager(s),o.pagerEl.addClass("bx-custom-pager")):(n=s+1,o.pagerEl.addClass("bx-default-pager")),e+='"}o.pagerEl.html(e)},T=function(){o.settings.pagerCustom?o.pagerEl=t(o.settings.pagerCustom):(o.pagerEl=t('
      '),o.settings.pagerSelector?t(o.settings.pagerSelector).html(o.pagerEl):o.controls.el.addClass("bx-has-pager").append(o.pagerEl),w()),o.pagerEl.on("click","a",I)},C=function(){o.controls.next=t(''+o.settings.nextText+""),o.controls.prev=t(''+o.settings.prevText+""),o.controls.next.bind("click",y),o.controls.prev.bind("click",z),o.settings.nextSelector&&t(o.settings.nextSelector).append(o.controls.next),o.settings.prevSelector&&t(o.settings.prevSelector).append(o.controls.prev),o.settings.nextSelector||o.settings.prevSelector||(o.controls.directionEl=t('
      '),o.controls.directionEl.append(o.controls.prev).append(o.controls.next),o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl))},E=function(){o.controls.start=t('"),o.controls.stop=t('"),o.controls.autoEl=t('
      '),o.controls.autoEl.on("click",".bx-start",k),o.controls.autoEl.on("click",".bx-stop",M),o.settings.autoControlsCombine?o.controls.autoEl.append(o.controls.start):o.controls.autoEl.append(o.controls.start).append(o.controls.stop),o.settings.autoControlsSelector?t(o.settings.autoControlsSelector).html(o.controls.autoEl):o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl),A(o.settings.autoStart?"stop":"start")},P=function(){o.children.each(function(){var e=t(this).find("img:first").attr("title");void 0!=e&&(""+e).length&&t(this).append('
      '+e+"
      ")})},y=function(t){o.settings.auto&&r.stopAuto(),r.goToNextSlide(),t.preventDefault()},z=function(t){o.settings.auto&&r.stopAuto(),r.goToPrevSlide(),t.preventDefault()},k=function(t){r.startAuto(),t.preventDefault()},M=function(t){r.stopAuto(),t.preventDefault()},I=function(e){o.settings.auto&&r.stopAuto();var i=t(e.currentTarget),s=parseInt(i.attr("data-slide-index"));s!=o.active.index&&r.goToSlide(s),e.preventDefault()},q=function(e){var i=o.children.length;return"short"==o.settings.pagerType?(o.settings.maxSlides>1&&(i=Math.ceil(o.children.length/o.settings.maxSlides)),o.pagerEl.html(e+1+o.settings.pagerShortSeparator+i),void 0):(o.pagerEl.find("a").removeClass("active"),o.pagerEl.each(function(i,s){t(s).find("a").eq(e).addClass("active")}),void 0)},D=function(){if(o.settings.infiniteLoop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onSlideAfter(o.children.eq(o.active.index),o.oldIndex,o.active.index)},A=function(t){o.settings.autoControlsCombine?o.controls.autoEl.html(o.controls[t]):(o.controls.autoEl.find("a").removeClass("active"),o.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},W=function(){1==x()?(o.controls.prev.addClass("disabled"),o.controls.next.addClass("disabled")):!o.settings.infiniteLoop&&o.settings.hideControlOnEnd&&(0==o.active.index?(o.controls.prev.addClass("disabled"),o.controls.next.removeClass("disabled")):o.active.index==x()-1?(o.controls.next.addClass("disabled"),o.controls.prev.removeClass("disabled")):(o.controls.prev.removeClass("disabled"),o.controls.next.removeClass("disabled")))},H=function(){o.settings.autoDelay>0?setTimeout(r.startAuto,o.settings.autoDelay):r.startAuto(),o.settings.autoHover&&r.hover(function(){o.interval&&(r.stopAuto(!0),o.autoPaused=!0)},function(){o.autoPaused&&(r.startAuto(!0),o.autoPaused=null)})},L=function(){var e=0;if("next"==o.settings.autoDirection)r.append(o.children.clone().addClass("bx-clone"));else{r.prepend(o.children.clone().addClass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autoControls=!1,o.settings.tickerHover&&!o.usingCSS&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(){e+="horizontal"==o.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)});var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-Math.abs(parseInt(r.css(s))));N(n)}),N()},N=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autoDirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetValue:n};b(s,"ticker",speed,a)},O=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",X)},X=function(t){if(o.working)t.preventDefault();else{o.touch.originalPos=r.position();var e=t.originalEvent;o.touch.start.x=e.changedTouches[0].pageX,o.touch.start.y=e.changedTouches[0].pageY,o.viewport.bind("touchmove",Y),o.viewport.bind("touchend",V)}},Y=function(t){var e=t.originalEvent,i=Math.abs(e.changedTouches[0].pageX-o.touch.start.x),s=Math.abs(e.changedTouches[0].pageY-o.touch.start.y);if(3*i>s&&o.settings.preventDefaultSwipeX?t.preventDefault():3*s>i&&o.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!=o.settings.mode&&o.settings.oneToOneTouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedTouches[0].pageX-o.touch.start.x;n=o.touch.originalPos.left+r}else{var r=e.changedTouches[0].pageY-o.touch.start.y;n=o.touch.originalPos.top+r}b(n,"reset",0)}},V=function(t){o.viewport.unbind("touchmove",Y);var e=t.originalEvent,i=0;if(o.touch.end.x=e.changedTouches[0].pageX,o.touch.end.y=e.changedTouches[0].pageY,"fade"==o.settings.mode){var s=Math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipeThreshold&&(o.touch.start.x>o.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalPos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalPos.top),!o.settings.infiniteLoop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):Math.abs(s)>=o.settings.swipeThreshold?(0>s?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):b(i,"reset",200)}o.viewport.unbind("touchend",V)},Z=function(){var e=t(window).width(),i=t(window).height();(a!=e||l!=i)&&(a=e,l=i,r.redrawSlider(),o.settings.onSliderResize.call(r,o.active.index))};return r.goToSlide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldIndex=o.active.index,o.active.index=0>e?x()-1:e>=x()?0:e,o.settings.onSlideBefore(o.children.eq(o.active.index),o.oldIndex,o.active.index),"next"==i?o.settings.onSlideNext(o.children.eq(o.active.index),o.oldIndex,o.active.index):"prev"==i&&o.settings.onSlidePrev(o.children.eq(o.active.index),o.oldIndex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&W(),"fade"==o.settings.mode)o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed),o.children.filter(":visible").fadeOut(o.settings.speed).css({zIndex:0}),o.children.eq(o.active.index).css("zIndex",o.settings.slideZIndex+1).fadeIn(o.settings.speed,function(){t(this).css("zIndex",o.settings.slideZIndex),D()});else{o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteLoop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerWidth()}else{var l=o.children.length-o.settings.minSlides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveSlides?o.settings.maxSlides-m():(x()-1)*m()-(o.children.length-o.settings.maxSlides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxSlides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.goToNextSlide=function(){if(o.settings.infiniteLoop||!o.active.last){var t=parseInt(o.active.index)+1;r.goToSlide(t,"next")}},r.goToPrevSlide=function(){if(o.settings.infiniteLoop||0!=o.active.index){var t=parseInt(o.active.index)-1;r.goToSlide(t,"prev")}},r.startAuto=function(t){o.interval||(o.interval=setInterval(function(){"next"==o.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},o.settings.pause),o.settings.autoControls&&1!=t&&A("stop"))},r.stopAuto=function(t){o.interval&&(clearInterval(o.interval),o.interval=null,o.settings.autoControls&&1!=t&&A("start"))},r.getCurrentSlide=function(){return o.active.index},r.getCurrentSlideElement=function(){return o.children.eq(o.active.index)},r.getSlideCount=function(){return o.children.length},r.redrawSlider=function(){o.children.add(r.find(".bx-clone")).outerWidth(u()),o.viewport.css("height",v()),o.settings.ticker||S(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagerCustom&&(w(),q(o.active.index))},r.destroySlider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!=t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerEl&&o.settings.controls&&o.pagerEl.remove(),t(".bx-caption",this).remove(),o.controls.autoEl&&o.controls.autoEl.remove(),clearInterval(o.interval),o.settings.responsive&&t(window).unbind("resize",Z))},r.reloadSlider=function(t){void 0!=t&&(n=t),r.destroySlider(),d()},d(),this}}(jQuery); // source --> https://www.responsenet.org/wp-content/plugins/wp-1-slider/js/wp1s-frontend-script.js?ver=1.2.7 function resize() { if (jQuery(window).width() <= 768) { jQuery('.wp1s-slider-wrapper').addClass('wp1s-resposive'); } else { jQuery('.wp1s-slider-wrapper').removeClass('wp1s-resposive');} } jQuery(document).ready(function($){ $(window).resize(resize); resize(); var ap_slider = {}; var ap_thumb_slider = []; var realThumbSlider; $('.wp1s-bxslider').each(function(){ var selector = $(this); var speed = $(this).data('speed'); var pause = $(this).data('pause'); var auto = $(this).data('auto'); var transition = $(this).data('transition'); var controls = $(this).data('controls'); var responsive = $(this).data('responsive'); var pager = $(this).data('pager'); var id = $(this).data('id'); pause = (pause=='')?4000:pause; if(pager=='disable'){ ap_slider.id = $(this).bxSlider({ speed: speed, pause: pause, auto: auto, pager: false, mode: transition, controls: controls, responsive:responsive, infiniteLoop: true, video: true, useCSS: false }); } else if(pager=='dot'){ ap_slider.id = $(this).bxSlider({ speed: speed, pause: pause, auto: auto, pager: true, mode: transition, controls: controls, responsive:responsive, infiniteLoop: true, video: true, useCSS: false }); } else if(pager=='pagination'){ ap_slider.id = $(this).bxSlider({ speed: speed, pause: pause, auto: auto, pager: true, mode: transition, controls: controls, responsive:responsive, infiniteLoop: true, pagerType: 'short', video: true, useCSS: false }); } else{ ap_slider.id = $(this).bxSlider({ speed: speed, pause: pause, auto: auto, pager: true, mode: transition, controls: controls, responsive:responsive, pagerCustom:'#wp1s-pager-'+id, useCSS:false, nextText:'', prevText:'', infiniteLoop: true, onSlideBefore:function($slideElement, oldIndex, newIndex){ selector.closest('.wp1s-slider-wrapper').find('.active').removeClass("active"); selector.closest('.wp1s-slider-wrapper').find('li a[data-slide-index="'+newIndex+'"]').addClass("active"); var slider = ap_thumb_slider[id]; if(slider.getSlideCount()-newIndex>=count)slider.goToSlide(newIndex); else slider.goToSlide(slider.getSlideCount()-count); } }); } }); var count=0; $(".wp1s-bxslider-pager").each(function(){ var id = $(this).data('id'); count = $(this).data('count'); ap_thumb_slider[id]= $(this).bxSlider({ minSlides: count, maxSlides: count, slideWidth: 150, slideMargin: 10, moveSlides: 1, auto: false, pager: false, infiniteLoop: false, nextText:'', prevText:'', }); }); }); // source --> https://www.responsenet.org/wp-content/plugins/wp-facebook-feed/includes/../bower_components/codebird-js/codebird.js?ver=5.2.4 /** * A Twitter library in JavaScript * * @package codebird * @version 2.5.0 * @author Jublo Solutions * @copyright 2010-2014 Jublo Solutions * @license http://opensource.org/licenses/GPL-3.0 GNU Public License 3.0 * @link https://github.com/jublonet/codebird-php */ /* jshint curly: true, eqeqeq: true, latedef: true, quotmark: double, undef: true, unused: true, trailing: true, laxbreak: true */ /* global window, document, navigator, console, Ti, ActiveXObject, module, define, require */ (function (undefined) { "use strict"; /** * Array.indexOf polyfill */ if (! Array.prototype.indexOf) { Array.prototype.indexOf = function (obj, start) { for (var i = (start || 0); i < this.length; i++) { if (this[i] === obj) { return i; } } return -1; }; } /** * A Twitter library in JavaScript * * @package codebird * @subpackage codebird-js */ /* jshint -W098 */ var Codebird = function () { /* jshint +W098 */ /** * The OAuth consumer key of your registered app */ var _oauth_consumer_key = null; /** * The corresponding consumer secret */ var _oauth_consumer_secret = null; /** * The app-only bearer token. Used to authorize app-only requests */ var _oauth_bearer_token = null; /** * The API endpoint base to use */ var _endpoint_base = "https://api.twitter.com/"; /** * The media API endpoint base to use */ var _endpoint_base_media = "https://upload.twitter.com/"; /** * The API endpoint to use */ var _endpoint = _endpoint_base + "1.1/"; /** * The media API endpoint to use */ var _endpoint_media = _endpoint_base_media + "1.1/"; /** * The API endpoint base to use */ var _endpoint_oauth = _endpoint_base; /** * API proxy endpoint */ var _endpoint_proxy = "https://api.jublo.net/codebird/"; /** * The API endpoint to use for old requests */ var _endpoint_old = _endpoint_base + "1/"; /** * Use JSONP for GET requests in IE7-9 */ var _use_jsonp = (typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined" && (navigator.userAgent.indexOf("Trident/4") > -1 || navigator.userAgent.indexOf("Trident/5") > -1 || navigator.userAgent.indexOf("MSIE 7.0") > -1 ) ); /** * Whether to access the API via a proxy that is allowed by CORS * Assume that CORS is only necessary in browsers */ var _use_proxy = (typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined" ); /** * The Request or access token. Used to sign requests */ var _oauth_token = null; /** * The corresponding request or access token secret */ var _oauth_token_secret = null; /** * The current Codebird version */ var _version = "2.5.0"; /** * Sets the OAuth consumer key and secret (App key) * * @param string key OAuth consumer key * @param string secret OAuth consumer secret * * @return void */ var setConsumerKey = function (key, secret) { _oauth_consumer_key = key; _oauth_consumer_secret = secret; }; /** * Sets the OAuth2 app-only auth bearer token * * @param string token OAuth2 bearer token * * @return void */ var setBearerToken = function (token) { _oauth_bearer_token = token; }; /** * Gets the current Codebird version * * @return string The version number */ var getVersion = function () { return _version; }; /** * Sets the OAuth request or access token and secret (User key) * * @param string token OAuth request or access token * @param string secret OAuth request or access token secret * * @return void */ var setToken = function (token, secret) { _oauth_token = token; _oauth_token_secret = secret; }; /** * Enables or disables CORS proxy * * @param bool use_proxy Whether to use CORS proxy or not * * @return void */ var setUseProxy = function (use_proxy) { _use_proxy = !! use_proxy; }; /** * Sets custom CORS proxy server * * @param string proxy Address of proxy server to use * * @return void */ var setProxy = function (proxy) { // add trailing slash if missing if (! proxy.match(/\/$/)) { proxy += "/"; } _endpoint_proxy = proxy; }; /** * Parse URL-style parameters into object * * version: 1109.2015 * discuss at: http://phpjs.org/functions/parse_str * + original by: Cagri Ekin * + improved by: Michael White (http://getsprink.com) * + tweaked by: Jack * + bugfixed by: Onno Marsman * + reimplemented by: stag019 * + bugfixed by: Brett Zamir (http://brett-zamir.me) * + bugfixed by: stag019 * - depends on: urldecode * + input by: Dreamer * + bugfixed by: Brett Zamir (http://brett-zamir.me) * % note 1: When no argument is specified, will put variables in global scope. * * @param string str String to parse * @param array array to load data into * * @return object */ var _parse_str = function (str, array) { var glue1 = "=", glue2 = "&", array2 = String(str).replace(/^&?([\s\S]*?)&?$/, "$1").split(glue2), i, j, chr, tmp, key, value, bracket, keys, evalStr, fixStr = function (str) { return decodeURIComponent(str).replace(/([\\"'])/g, "\\$1").replace(/\n/g, "\\n").replace(/\r/g, "\\r"); }; if (! array) { array = this.window; } for (i = 0; i < array2.length; i++) { tmp = array2[i].split(glue1); if (tmp.length < 2) { tmp = [tmp, ""]; } key = fixStr(tmp[0]); value = fixStr(tmp[1]); while (key.charAt(0) === " ") { key = key.substr(1); } if (key.indexOf("\0") !== -1) { key = key.substr(0, key.indexOf("\0")); } if (key && key.charAt(0) !== "[") { keys = []; bracket = 0; for (j = 0; j < key.length; j++) { if (key.charAt(j) === "[" && !bracket) { bracket = j + 1; } else if (key.charAt(j) === "]") { if (bracket) { if (!keys.length) { keys.push(key.substr(0, bracket - 1)); } keys.push(key.substr(bracket, j - bracket)); bracket = 0; if (key.charAt(j + 1) !== "[") { break; } } } } if (!keys.length) { keys = [key]; } for (j = 0; j < keys[0].length; j++) { chr = keys[0].charAt(j); if (chr === " " || chr === "." || chr === "[") { keys[0] = keys[0].substr(0, j) + "_" + keys[0].substr(j + 1); } if (chr === "[") { break; } } /* jshint -W061 */ evalStr = "array"; for (j = 0; j < keys.length; j++) { key = keys[j]; if ((key !== "" && key !== " ") || j === 0) { key = "'" + key + "'"; } else { key = eval(evalStr + ".push([]);") - 1; } evalStr += "[" + key + "]"; if (j !== keys.length - 1 && eval("typeof " + evalStr) === "undefined") { eval(evalStr + " = [];"); } } evalStr += " = '" + value + "';\n"; eval(evalStr); /* jshint +W061 */ } } }; /** * Main API handler working on any requests you issue * * @param string fn The member function you called * @param array params The parameters you sent along * @param function callback The callback to call with the reply * @param bool app_only_auth Whether to use app-only auth * * @return mixed The API reply encoded in the set return_format */ var __call = function (fn, params, callback, app_only_auth) { if (typeof params === "undefined") { params = {}; } if (typeof app_only_auth === "undefined") { app_only_auth = false; } if (typeof callback !== "function" && typeof params === "function") { callback = params; params = {}; if (typeof callback === "boolean") { app_only_auth = callback; } } else if (typeof callback === "undefined") { callback = function () {}; } switch (fn) { case "oauth_authenticate": case "oauth_authorize": return this[fn](params, callback); case "oauth2_token": return this[fn](callback); } // reset token when requesting a new token (causes 401 for signature error on 2nd+ requests) if (fn === "oauth_requestToken") { setToken(null, null); } // parse parameters var apiparams = {}; if (typeof params === "object") { apiparams = params; } else { _parse_str(params, apiparams); //TODO } // map function name to API method var method = ""; var param, i, j; // replace _ by / var path = fn.split("_"); for (i = 0; i < path.length; i++) { if (i > 0) { method += "/"; } method += path[i]; } // undo replacement for URL parameters var url_parameters_with_underscore = ["screen_name", "place_id"]; for (i = 0; i < url_parameters_with_underscore.length; i++) { param = url_parameters_with_underscore[i].toUpperCase(); var replacement_was = param.split("_").join("/"); method = method.split(replacement_was).join(param); } // replace AA by URL parameters var method_template = method; var match = method.match(/[A-Z_]{2,}/); if (match) { for (i = 0; i < match.length; i++) { param = match[i]; var param_l = param.toLowerCase(); method_template = method_template.split(param).join(":" + param_l); if (typeof apiparams[param_l] === "undefined") { for (j = 0; j < 26; j++) { method_template = method_template.split(String.fromCharCode(65 + j)).join("_" + String.fromCharCode(97 + j)); } console.warn("To call the templated method \"" + method_template + "\", specify the parameter value for \"" + param_l + "\"."); } method = method.split(param).join(apiparams[param_l]); delete apiparams[param_l]; } } // replace A-Z by _a-z for (i = 0; i < 26; i++) { method = method.split(String.fromCharCode(65 + i)).join("_" + String.fromCharCode(97 + i)); method_template = method_template.split(String.fromCharCode(65 + i)).join("_" + String.fromCharCode(97 + i)); } var httpmethod = _detectMethod(method_template, apiparams); var multipart = _detectMultipart(method_template); var internal = _detectInternal(method_template); return _callApi( httpmethod, method, apiparams, multipart, app_only_auth, internal, callback ); }; /** * Gets the OAuth authenticate URL for the current request token * * @return string The OAuth authenticate URL */ var oauth_authenticate = function (params, callback) { if (typeof params.force_login === "undefined") { params.force_login = null; } if (typeof params.screen_name === "undefined") { params.screen_name = null; } if (_oauth_token === null) { console.warn("To get the authenticate URL, the OAuth token must be set."); } var url = _endpoint_oauth + "oauth/authenticate?oauth_token=" + _url(_oauth_token); if (params.force_login === true) { url += "?force_login=1"; if (params.screen_name !== null) { url += "&screen_name=" + params.screen_name; } } callback(url); return true; }; /** * Gets the OAuth authorize URL for the current request token * * @return string The OAuth authorize URL */ var oauth_authorize = function (params, callback) { if (typeof params.force_login === "undefined") { params.force_login = null; } if (typeof params.screen_name === "undefined") { params.screen_name = null; } if (_oauth_token === null) { console.warn("To get the authorize URL, the OAuth token must be set."); } var url = _endpoint_oauth + "oauth/authorize?oauth_token=" + _url(_oauth_token); if (params.force_login === true) { url += "?force_login=1"; if (params.screen_name !== null) { url += "&screen_name=" + params.screen_name; } } callback(url); return true; }; /** * Gets the OAuth bearer token * * @return string The OAuth bearer token */ var oauth2_token = function (callback) { if (_oauth_consumer_key === null) { console.warn("To obtain a bearer token, the consumer key must be set."); } if (typeof callback === "undefined") { callback = function () {}; } var post_fields = "grant_type=client_credentials"; var url = _endpoint_oauth + "oauth2/token"; if (_use_proxy) { url = url.replace( _endpoint_base, _endpoint_proxy ); } var xml = _getXmlRequestObject(); if (xml === null) { return; } xml.open("POST", url, true); xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xml.setRequestHeader( (_use_proxy ? "X-" : "") + "Authorization", "Basic " + _base64_encode(_oauth_consumer_key + ":" + _oauth_consumer_secret) ); xml.onreadystatechange = function () { if (xml.readyState >= 4) { var httpstatus = 12027; try { httpstatus = xml.status; } catch (e) {} var response = ""; try { response = xml.responseText; } catch (e) {} var reply = _parseApiReply(response); reply.httpstatus = httpstatus; if (httpstatus === 200) { setBearerToken(reply.access_token); } callback(reply); } }; xml.send(post_fields); }; /** * Signing helpers */ /** * URL-encodes the given data * * @param mixed data * * @return mixed The encoded data */ var _url = function (data) { if ((/boolean|number|string/).test(typeof data)) { return encodeURIComponent(data).replace(/!/g, "%21").replace(/'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/\*/g, "%2A"); } else { return ""; } }; /** * Gets the base64-encoded SHA1 hash for the given data * * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 * Based on version 2.1 Copyright Paul Johnston 2000 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for details. * * @param string data The data to calculate the hash from * * @return string The hash */ var _sha1 = function () { function n(e, b) { e[b >> 5] |= 128 << 24 - b % 32; e[(b + 64 >> 9 << 4) + 15] = b; for (var c = new Array(80), a = 1732584193, d = -271733879, h = -1732584194, k = 271733878, g = -1009589776, p = 0; p < e.length; p += 16) { for (var o = a, q = d, r = h, s = k, t = g, f = 0; 80 > f; f++) { var m; if (f < 16) { m = e[p + f]; } else { m = c[f - 3] ^ c[f - 8] ^ c[f - 14] ^ c[f - 16]; m = m << 1 | m >>> 31; } c[f] = m; m = l(l(a << 5 | a >>> 27, 20 > f ? d & h | ~d & k : 40 > f ? d ^ h ^ k : 60 > f ? d & h | d & k | h & k : d ^ h ^ k), l( l(g, c[f]), 20 > f ? 1518500249 : 40 > f ? 1859775393 : 60 > f ? -1894007588 : -899497514)); g = k; k = h; h = d << 30 | d >>> 2; d = a; a = m; } a = l(a, o); d = l(d, q); h = l(h, r); k = l(k, s); g = l(g, t); } return [a, d, h, k, g]; } function l(e, b) { var c = (e & 65535) + (b & 65535); return (e >> 16) + (b >> 16) + (c >> 16) << 16 | c & 65535; } function q(e) { for (var b = [], c = (1 << g) - 1, a = 0; a < e.length * g; a += g) { b[a >> 5] |= (e.charCodeAt(a / g) & c) << 24 - a % 32; } return b; } var g = 8; return function (e) { var b = _oauth_consumer_secret + "&" + (null !== _oauth_token_secret ? _oauth_token_secret : ""); if (_oauth_consumer_secret === null) { console.warn("To generate a hash, the consumer secret must be set."); } var c = q(b); if (c.length > 16) { c = n(c, b.length * g); } b = new Array(16); for (var a = new Array(16), d = 0; d < 16; d++) { a[d] = c[d] ^ 909522486; b[d] = c[d] ^ 1549556828; } c = n(a.concat(q(e)), 512 + e.length * g); b = n(b.concat(c), 672); c = ""; for (a = 0; a < 4 * b.length; a += 3) { for (d = (b[a >> 2] >> 8 * (3 - a % 4) & 255) << 16 | (b[a + 1 >> 2] >> 8 * (3 - (a + 1) % 4) & 255) << 8 | b[a + 2 >> 2] >> 8 * (3 - (a + 2) % 4) & 255, e = 0; 4 > e; e++) { c = 8 * a + 6 * e > 32 * b.length ? c + "=" : c + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" .charAt(d >> 6 * (3 - e) & 63); } } return c; }; }(); /* * Gets the base64 representation for the given data * * http://phpjs.org * + original by: Tyler Akins (http://rumkin.com) * + improved by: Bayron Guevara * + improved by: Thunder.m * + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) * + bugfixed by: Pellentesque Malesuada * + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) * + improved by: Rafał Kukawski (http://kukawski.pl) * * @param string data The data to calculate the base64 representation from * * @return string The base64 representation */ var _base64_encode = function (a) { var d, e, f, b, g = 0, h = 0, i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", c = []; if (!a) { return a; } do { d = a.charCodeAt(g++); e = a.charCodeAt(g++); f = a.charCodeAt(g++); b = d << 16 | e << 8 | f; d = b >> 18 & 63; e = b >> 12 & 63; f = b >> 6 & 63; b &= 63; c[h++] = i.charAt(d) + i.charAt(e) + i.charAt(f) + i.charAt(b); } while (g < a.length); c = c.join(""); a = a.length % 3; return (a ? c.slice(0, a - 3) : c) + "===".slice(a || 3); }; /* * Builds a HTTP query string from the given data * * http://phpjs.org * + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) * + improved by: Legaev Andrey * + improved by: Michael White (http://getsprink.com) * + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) * + improved by: Brett Zamir (http://brett-zamir.me) * + revised by: stag019 * + input by: Dreamer * + bugfixed by: Brett Zamir (http://brett-zamir.me) * + bugfixed by: MIO_KODUKI (http://mio-koduki.blogspot.com/) * * @param string data The data to concatenate * * @return string The HTTP query */ var _http_build_query = function (e, f, b) { function g(c, a, d) { var b, e = []; if (a === true) { a = "1"; } else if (a === false) { a = "0"; } if (null !== a) { if (typeof a === "object") { for (b in a) { if (a[b] !== null) { e.push(g(c + "[" + b + "]", a[b], d)); } } return e.join(d); } if (typeof a !== "function") { return _url(c) + "=" + _url(a); } console.warn("There was an error processing for http_build_query()."); } else { return ""; } } var d, c, h = []; if (! b) { b = "&"; } for (c in e) { d = e[c]; if (f && ! isNaN(c)) { c = String(f) + c; } d = g(c, d, b); if (d !== "") { h.push(d); } } return h.join(b); }; /** * Generates a (hopefully) unique random string * * @param int optional length The length of the string to generate * * @return string The random string */ var _nonce = function (length) { if (typeof length === "undefined") { length = 8; } if (length < 1) { console.warn("Invalid nonce length."); } var nonce = ""; for (var i = 0; i < length; i++) { var character = Math.floor(Math.random() * 61); nonce += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".substring(character, character + 1); } return nonce; }; /** * Sort array elements by key * * @param array input_arr The array to sort * * @return array The sorted keys */ var _ksort = function (input_arr) { var keys = [], sorter, k; sorter = function (a, b) { var a_float = parseFloat(a), b_float = parseFloat(b), a_numeric = a_float + "" === a, b_numeric = b_float + "" === b; if (a_numeric && b_numeric) { return a_float > b_float ? 1 : a_float < b_float ? -1 : 0; } else if (a_numeric && !b_numeric) { return 1; } else if (!a_numeric && b_numeric) { return -1; } return a > b ? 1 : a < b ? -1 : 0; }; // Make a list of key names for (k in input_arr) { if (input_arr.hasOwnProperty(k)) { keys.push(k); } } keys.sort(sorter); return keys; }; /** * Clone objects * * @param object obj The object to clone * * @return object clone The cloned object */ var _clone = function (obj) { var clone = {}; for (var i in obj) { if (typeof(obj[i]) === "object") { clone[i] = _clone(obj[i]); } else { clone[i] = obj[i]; } } return clone; }; /** * Generates an OAuth signature * * @param string httpmethod Usually either 'GET' or 'POST' or 'DELETE' * @param string method The API method to call * @param array optional params The API call parameters, associative * @param bool optional append_to_get Whether to append the OAuth params to GET * * @return string Authorization HTTP header */ var _sign = function (httpmethod, method, params, append_to_get) { if (typeof params === "undefined") { params = {}; } if (typeof append_to_get === "undefined") { append_to_get = false; } if (_oauth_consumer_key === null) { console.warn("To generate a signature, the consumer key must be set."); } var sign_params = { consumer_key: _oauth_consumer_key, version: "1.0", timestamp: Math.round(new Date().getTime() / 1000), nonce: _nonce(), signature_method: "HMAC-SHA1" }; var sign_base_params = {}; var value; for (var key in sign_params) { value = sign_params[key]; sign_base_params["oauth_" + key] = _url(value); } if (_oauth_token !== null) { sign_base_params.oauth_token = _url(_oauth_token); } var oauth_params = _clone(sign_base_params); for (key in params) { value = params[key]; sign_base_params[key] = value; } var keys = _ksort(sign_base_params); var sign_base_string = ""; for (var i = 0; i < keys.length; i++) { key = keys[i]; value = sign_base_params[key]; sign_base_string += key + "=" + _url(value) + "&"; } sign_base_string = sign_base_string.substring(0, sign_base_string.length - 1); var signature = _sha1(httpmethod + "&" + _url(method) + "&" + _url(sign_base_string)); params = append_to_get ? sign_base_params : oauth_params; params.oauth_signature = signature; keys = _ksort(params); var authorization = ""; if (append_to_get) { for(i = 0; i < keys.length; i++) { key = keys[i]; value = params[key]; authorization += key + "=" + _url(value) + "&"; } return authorization.substring(0, authorization.length - 1); } authorization = "OAuth "; for (i = 0; i < keys.length; i++) { key = keys[i]; value = params[key]; authorization += key + "=\"" + _url(value) + "\", "; } return authorization.substring(0, authorization.length - 2); }; /** * Detects HTTP method to use for API call * * @param string method The API method to call * @param array params The parameters to send along * * @return string The HTTP method that should be used */ var _detectMethod = function (method, params) { // multi-HTTP method endpoints switch (method) { case "account/settings": case "account/login_verification_enrollment": case "account/login_verification_request": method = params.length ? method + "__post" : method; break; } var httpmethods = {}; httpmethods.GET = [ // Timelines "statuses/mentions_timeline", "statuses/user_timeline", "statuses/home_timeline", "statuses/retweets_of_me", // Tweets "statuses/retweets/:id", "statuses/show/:id", "statuses/oembed", "statuses/retweeters/ids", // Search "search/tweets", // Direct Messages "direct_messages", "direct_messages/sent", "direct_messages/show", // Friends & Followers "friendships/no_retweets/ids", "friends/ids", "followers/ids", "friendships/lookup", "friendships/incoming", "friendships/outgoing", "friendships/show", "friends/list", "followers/list", "friendships/lookup", // Users "account/settings", "account/verify_credentials", "blocks/list", "blocks/ids", "users/lookup", "users/show", "users/search", "users/contributees", "users/contributors", "users/profile_banner", "mutes/users/ids", "mutes/users/list", // Suggested Users "users/suggestions/:slug", "users/suggestions", "users/suggestions/:slug/members", // Favorites "favorites/list", // Lists "lists/list", "lists/statuses", "lists/memberships", "lists/subscribers", "lists/subscribers/show", "lists/members/show", "lists/members", "lists/show", "lists/subscriptions", "lists/ownerships", // Saved searches "saved_searches/list", "saved_searches/show/:id", // Places & Geo "geo/id/:place_id", "geo/reverse_geocode", "geo/search", "geo/similar_places", // Trends "trends/place", "trends/available", "trends/closest", // OAuth "oauth/authenticate", "oauth/authorize", // Help "help/configuration", "help/languages", "help/privacy", "help/tos", "application/rate_limit_status", // Tweets "statuses/lookup", // Internal "users/recommendations", "account/push_destinations/device", "activity/about_me", "activity/by_friends", "statuses/media_timeline", "timeline/home", "help/experiments", "search/typeahead", "search/universal", "discover/universal", "conversation/show", "statuses/:id/activity/summary", "account/login_verification_enrollment", "account/login_verification_request", "prompts/suggest", "beta/timelines/custom/list", "beta/timelines/timeline", "beta/timelines/custom/show" ]; httpmethods.POST = [ // Tweets "statuses/destroy/:id", "statuses/update", "statuses/retweet/:id", "statuses/update_with_media", "media/upload", // Direct Messages "direct_messages/destroy", "direct_messages/new", // Friends & Followers "friendships/create", "friendships/destroy", "friendships/update", // Users "account/settings__post", "account/update_delivery_device", "account/update_profile", "account/update_profile_background_image", "account/update_profile_colors", "account/update_profile_image", "blocks/create", "blocks/destroy", "account/update_profile_banner", "account/remove_profile_banner", "mutes/users/create", "mutes/users/destroy", // Favorites "favorites/destroy", "favorites/create", // Lists "lists/members/destroy", "lists/subscribers/create", "lists/subscribers/destroy", "lists/members/create_all", "lists/members/create", "lists/destroy", "lists/update", "lists/create", "lists/members/destroy_all", // Saved Searches "saved_searches/create", "saved_searches/destroy/:id", // Spam Reporting "users/report_spam", // OAuth "oauth/access_token", "oauth/request_token", "oauth2/token", "oauth2/invalidate_token", // Internal "direct_messages/read", "account/login_verification_enrollment__post", "push_destinations/enable_login_verification", "account/login_verification_request__post", "beta/timelines/custom/create", "beta/timelines/custom/update", "beta/timelines/custom/destroy", "beta/timelines/custom/add", "beta/timelines/custom/remove" ]; for (var httpmethod in httpmethods) { if (httpmethods[httpmethod].indexOf(method) > -1) { return httpmethod; } } console.warn("Can't find HTTP method to use for \"" + method + "\"."); }; /** * Detects if API call should use multipart/form-data * * @param string method The API method to call * * @return bool Whether the method should be sent as multipart */ var _detectMultipart = function (method) { var multiparts = [ // Tweets "statuses/update_with_media", // Users "account/update_profile_background_image", "account/update_profile_image", "account/update_profile_banner" ]; return multiparts.indexOf(method) > -1; }; /** * Build multipart request from upload params * * @param string method The API method to call * @param array params The parameters to send along * * @return null|string The built multipart request body */ var _buildMultipart = function (method, params) { // well, files will only work in multipart methods if (! _detectMultipart(method)) { return; } // only check specific parameters var possible_methods = [ // Tweets "statuses/update_with_media", // Accounts "account/update_profile_background_image", "account/update_profile_image", "account/update_profile_banner" ]; var possible_files = { // Tweets "statuses/update_with_media": "media[]", // Accounts "account/update_profile_background_image": "image", "account/update_profile_image": "image", "account/update_profile_banner": "banner" }; // method might have files? if (possible_methods.indexOf(method) === -1) { return; } // check for filenames possible_files = possible_files[method].split(" "); var multipart_border = "--------------------" + _nonce(); var multipart_request = ""; for (var key in params) { multipart_request += "--" + multipart_border + "\r\n" + "Content-Disposition: form-data; name=\"" + key + "\""; if (possible_files.indexOf(key) > -1) { multipart_request += "\r\nContent-Transfer-Encoding: base64"; } multipart_request += "\r\n\r\n" + params[key] + "\r\n"; } multipart_request += "--" + multipart_border + "--"; return multipart_request; }; /** * Detects if API call is internal * * @param string method The API method to call * * @return bool Whether the method is defined in internal API */ var _detectInternal = function (method) { var internals = [ "users/recommendations" ]; return internals.join(" ").indexOf(method) > -1; }; /** * Detects if API call should use media endpoint * * @param string method The API method to call * * @return bool Whether the method is defined in media API */ var _detectMedia = function (method) { var medias = [ "media/upload" ]; return medias.join(" ").indexOf(method) > -1; }; /** * Detects if API call should use old endpoint * * @param string method The API method to call * * @return bool Whether the method is defined in old API */ var _detectOld = function (method) { var olds = [ "account/push_destinations/device" ]; return olds.join(" ").indexOf(method) > -1; }; /** * Builds the complete API endpoint url * * @param string method The API method to call * * @return string The URL to send the request to */ var _getEndpoint = function (method) { var url; if (method.substring(0, 5) === "oauth") { url = _endpoint_oauth + method; } else if (_detectMedia(method)) { url = _endpoint_media + method + ".json"; } else if (_detectOld(method)) { url = _endpoint_old + method + ".json"; } else { url = _endpoint + method + ".json"; } return url; }; /** * Gets the XML HTTP Request object, trying to load it in various ways * * @return object The XMLHttpRequest object instance */ var _getXmlRequestObject = function () { var xml = null; // first, try the W3-standard object if (typeof window === "object" && window && typeof window.XMLHttpRequest !== "undefined" ) { xml = new window.XMLHttpRequest(); // then, try Titanium framework object } else if (typeof Ti === "object" && Ti && typeof Ti.Network.createHTTPClient !== "undefined" ) { xml = Ti.Network.createHTTPClient(); // are we in an old Internet Explorer? } else if (typeof ActiveXObject !== "undefined" ) { try { xml = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { console.error("ActiveXObject object not defined."); } // now, consider RequireJS and/or Node.js objects } else if (typeof require === "function" && require ) { // look for xmlhttprequest module try { var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; xml = new XMLHttpRequest(); } catch (e1) { // or maybe the user is using xhr2 try { var XMLHttpRequest = require("xhr2"); xml = new XMLHttpRequest(); } catch (e2) { console.error("xhr2 object not defined, cancelling."); } } } return xml; }; /** * Calls the API using cURL * * @param string httpmethod The HTTP method to use for making the request * @param string method The API method to call * @param array optional params The parameters to send along * @param bool optional multipart Whether to use multipart/form-data * @param bool optional app_only_auth Whether to use app-only bearer authentication * @param bool optional internal Whether to use internal call * @param function callback The function to call with the API call result * * @return mixed The API reply, encoded in the set return_format */ var _callApi = function (httpmethod, method, params, multipart, app_only_auth, internal, callback) { if (typeof params === "undefined") { params = {}; } if (typeof multipart === "undefined") { multipart = false; } if (typeof app_only_auth === "undefined") { app_only_auth = false; } if (typeof callback !== "function") { callback = function () {}; } if (internal) { params.adc = "phone"; params.application_id = 333903271; } var url = _getEndpoint(method); var authorization = null; var xml = _getXmlRequestObject(); if (xml === null) { return; } var post_fields; if (httpmethod === "GET") { var url_with_params = url; if (JSON.stringify(params) !== "{}") { url_with_params += "?" + _http_build_query(params); } if (! app_only_auth) { authorization = _sign(httpmethod, url, params); } // append auth params to GET url for IE7-9, to send via JSONP if (_use_jsonp) { if (JSON.stringify(params) !== "{}") { url_with_params += "&"; } else { url_with_params += "?"; } var callback_name = _nonce(); window[callback_name] = function (reply) { reply.httpstatus = 200; var rate = null; if (typeof xml.getResponseHeader !== "undefined" && xml.getResponseHeader("x-rate-limit-limit") !== "" ) { rate = { limit: xml.getResponseHeader("x-rate-limit-limit"), remaining: xml.getResponseHeader("x-rate-limit-remaining"), reset: xml.getResponseHeader("x-rate-limit-reset") }; } callback(reply, rate); }; params.callback = callback_name; url_with_params = url + "?" + _sign(httpmethod, url, params, true); var tag = document.createElement("script"); tag.type = "text/javascript"; tag.src = url_with_params; var body = document.getElementsByTagName("body")[0]; body.appendChild(tag); return; } else if (_use_proxy) { url_with_params = url_with_params.replace( _endpoint_base, _endpoint_proxy ).replace( _endpoint_base_media, _endpoint_proxy ); } xml.open(httpmethod, url_with_params, true); } else { if (_use_jsonp) { console.warn("Sending POST requests is not supported for IE7-9."); return; } if (multipart) { if (! app_only_auth) { authorization = _sign(httpmethod, url, {}); } params = _buildMultipart(method, params); } else { if (! app_only_auth) { authorization = _sign(httpmethod, url, params); } params = _http_build_query(params); } post_fields = params; if (_use_proxy || multipart) { // force proxy for multipart base64 url = url.replace( _endpoint_base, _endpoint_proxy ).replace( _endpoint_base_media, _endpoint_proxy ); } xml.open(httpmethod, url, true); if (multipart) { xml.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + post_fields.split("\r\n")[0].substring(2)); } else { xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } } if (app_only_auth) { if (_oauth_consumer_key === null && _oauth_bearer_token === null ) { console.warn("To make an app-only auth API request, consumer key or bearer token must be set."); } // automatically fetch bearer token, if necessary if (_oauth_bearer_token === null) { return oauth2_token(function () { _callApi(httpmethod, method, params, multipart, app_only_auth, false, callback); }); } authorization = "Bearer " + _oauth_bearer_token; } if (authorization !== null) { xml.setRequestHeader((_use_proxy ? "X-" : "") + "Authorization", authorization); } xml.onreadystatechange = function () { if (xml.readyState >= 4) { var httpstatus = 12027; try { httpstatus = xml.status; } catch (e) {} var response = ""; try { response = xml.responseText; } catch (e) {} var reply = _parseApiReply(response); reply.httpstatus = httpstatus; var rate = null; if (typeof xml.getResponseHeader !== "undefined" && xml.getResponseHeader("x-rate-limit-limit") !== "" ) { rate = { limit: xml.getResponseHeader("x-rate-limit-limit"), remaining: xml.getResponseHeader("x-rate-limit-remaining"), reset: xml.getResponseHeader("x-rate-limit-reset") }; } callback(reply, rate); } }; xml.send(httpmethod === "GET" ? null : post_fields); return true; }; /** * Parses the API reply to encode it in the set return_format * * @param string reply The actual reply, JSON-encoded or URL-encoded * * @return array|object The parsed reply */ var _parseApiReply = function (reply) { if (typeof reply !== "string" || reply === "") { return {}; } if (reply === "[]") { return []; } var parsed; try { parsed = JSON.parse(reply); } catch (e) { parsed = {}; if (reply.indexOf("<" + "?xml version=\"1.0\" encoding=\"UTF-8\"?" + ">") === 0) { // we received XML... // since this only happens for errors, // don't perform a full decoding parsed.request = reply.match(/(.*)<\/request>/)[1]; parsed.error = reply.match(/(.*)<\/error>/)[1]; } else { // assume query format var elements = reply.split("&"); for (var i = 0; i < elements.length; i++) { var element = elements[i].split("=", 2); if (element.length > 1) { parsed[element[0]] = decodeURIComponent(element[1]); } else { parsed[element[0]] = null; } } } } return parsed; }; return { setConsumerKey: setConsumerKey, getVersion: getVersion, setToken: setToken, setBearerToken: setBearerToken, setUseProxy: setUseProxy, setProxy: setProxy, __call: __call, oauth_authenticate: oauth_authenticate, oauth_authorize: oauth_authorize, oauth2_token: oauth2_token }; }; if (typeof module === "object" && module && typeof module.exports === "object" ) { // Expose codebird as module.exports in loaders that implement the Node // module pattern (including browserify). Do not create the global, since // the user will be storing it themselves locally, and globals are frowned // upon in the Node module world. module.exports = Codebird; } else { // Otherwise expose codebird to the global object as usual if (typeof window === "object" && window) { window.Codebird = Codebird; } // Register as a named AMD module, since codebird can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase codebird is used because AMD module names are // derived from file names, and codebird is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of codebird, it will work. if (typeof define === "function" && define.amd) { define("codebird", [], function () { return Codebird; }); } } })(); // source --> https://www.responsenet.org/wp-content/plugins/wp-facebook-feed/includes/../bower_components/doT/doT.min.js?ver=5.2.4 /* Laura Doktorova https://github.com/olado/doT */ (function(){function o(){var a={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},b=/&(?!#?\w+;)|<|>|"|'|\//g;return function(){return this?this.replace(b,function(c){return a[c]||c}):this}}function p(a,b,c){return(typeof b==="string"?b:b.toString()).replace(a.define||i,function(l,e,f,g){if(e.indexOf("def.")===0)e=e.substring(4);if(!(e in c))if(f===":"){a.defineParams&&g.replace(a.defineParams,function(n,h,d){c[e]={arg:h,text:d}});e in c||(c[e]=g)}else(new Function("def","def['"+ e+"']="+g))(c);return""}).replace(a.use||i,function(l,e){if(a.useParams)e=e.replace(a.useParams,function(g,n,h,d){if(c[h]&&c[h].arg&&d){g=(h+":"+d).replace(/'|\\/g,"_");c.__exp=c.__exp||{};c.__exp[g]=c[h].text.replace(RegExp("(^|[^\\w$])"+c[h].arg+"([^\\w$])","g"),"$1"+d+"$2");return n+"def.__exp['"+g+"']"}});var f=(new Function("def","return "+e))(c);return f?p(a,f,c):f})}function m(a){return a.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var j={version:"1.0.1",templateSettings:{evaluate:/\{\{([\s\S]+?(\}?)+)\}\}/g, interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:true,append:true,selfcontained:false},template:undefined, compile:undefined},q;if(typeof module!=="undefined"&&module.exports)module.exports=j;else if(typeof define==="function"&&define.amd)define(function(){return j});else{q=function(){return this||(0,eval)("this")}();q.doT=j}String.prototype.encodeHTML=o();var r={append:{start:"'+(",end:")+'",endencode:"||'').toString().encodeHTML()+'"},split:{start:"';out+=(",end:");out+='",endencode:"||'').toString().encodeHTML();out+='"}},i=/$^/;j.template=function(a,b,c){b=b||j.templateSettings;var l=b.append?r.append: r.split,e,f=0,g;a=b.use||b.define?p(b,a,c||{}):a;a=("var out='"+(b.strip?a.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):a).replace(/'|\\/g,"\\$&").replace(b.interpolate||i,function(h,d){return l.start+m(d)+l.end}).replace(b.encode||i,function(h,d){e=true;return l.start+m(d)+l.endencode}).replace(b.conditional||i,function(h,d,k){return d?k?"';}else if("+m(k)+"){out+='":"';}else{out+='":k?"';if("+m(k)+"){out+='":"';}out+='"}).replace(b.iterate||i,function(h, d,k,s){if(!d)return"';} } out+='";f+=1;g=s||"i"+f;d=m(d);return"';var arr"+f+"="+d+";if(arr"+f+"){var "+k+","+g+"=-1,l"+f+"=arr"+f+".length-1;while("+g+" https://www.responsenet.org/wp-content/plugins/wp-facebook-feed/includes/../bower_components/moment/min/moment.min.js?ver=5.2.4 //! moment.js //! version : 2.8.3 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com (function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return zb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){tb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return m(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){qc[a]||(e(b),qc[a]=!0)}function h(a,b){return function(c){return p(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(){}function k(a,b){b!==!1&&F(a),n(this,a),this._d=new Date(+a._d)}function l(a){var b=y(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=tb.localeData(),this._bubble()}function m(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function n(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Ib.length>0)for(c in Ib)d=Ib[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function o(a){return 0>a?Math.ceil(a):Math.floor(a)}function p(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthd;d++)(c&&a[d]!==b[d]||!c&&A(a[d])!==A(b[d]))&&g++;return g+f}function x(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=jc[a]||kc[b]||b}return a}function y(a){var b,d,e={};for(d in a)c(a,d)&&(b=x(d),b&&(e[b]=a[d]));return e}function z(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}tb[b]=function(e,f){var g,h,i=tb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=tb().utc().set(d,a);return i.call(tb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function A(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function B(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function C(a,b,c){return hb(tb([a,11,31+b-c]),b,c).week}function D(a){return E(a)?366:365}function E(a){return a%4===0&&a%100!==0||a%400===0}function F(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Bb]<0||a._a[Bb]>11?Bb:a._a[Cb]<1||a._a[Cb]>B(a._a[Ab],a._a[Bb])?Cb:a._a[Db]<0||a._a[Db]>23?Db:a._a[Eb]<0||a._a[Eb]>59?Eb:a._a[Fb]<0||a._a[Fb]>59?Fb:a._a[Gb]<0||a._a[Gb]>999?Gb:-1,a._pf._overflowDayOfYear&&(Ab>b||b>Cb)&&(b=Cb),a._pf.overflow=b)}function G(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function H(a){return a?a.toLowerCase().replace("_","-"):a}function I(a){for(var b,c,d,e,f=0;f0;){if(d=J(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&w(e,c,!0)>=b-1)break;b--}f++}return null}function J(a){var b=null;if(!Hb[a]&&Jb)try{b=tb.locale(),require("./locale/"+a),tb.locale(b)}catch(c){}return Hb[a]}function K(a,b){return b._isUTC?tb(a).zone(b._offset||0):tb(a).local()}function L(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function M(a){var b,c,d=a.match(Nb);for(b=0,c=d.length;c>b;b++)d[b]=pc[d[b]]?pc[d[b]]:L(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function N(a,b){return a.isValid()?(b=O(b,a.localeData()),lc[b]||(lc[b]=M(b)),lc[b](a)):a.localeData().invalidDate()}function O(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Ob.lastIndex=0;d>=0&&Ob.test(a);)a=a.replace(Ob,c),Ob.lastIndex=0,d-=1;return a}function P(a,b){var c,d=b._strict;switch(a){case"Q":return Zb;case"DDDD":return _b;case"YYYY":case"GGGG":case"gggg":return d?ac:Rb;case"Y":case"G":case"g":return cc;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?bc:Sb;case"S":if(d)return Zb;case"SS":if(d)return $b;case"SSS":if(d)return _b;case"DDD":return Qb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ub;case"a":case"A":return b._locale._meridiemParse;case"X":return Xb;case"Z":case"ZZ":return Vb;case"T":return Wb;case"SSSS":return Tb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?$b:Pb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Pb;case"Do":return Yb;default:return c=new RegExp(Y(X(a.replace("\\","")),"i"))}}function Q(a){a=a||"";var b=a.match(Vb)||[],c=b[b.length-1]||[],d=(c+"").match(hc)||["-",0,0],e=+(60*d[1])+A(d[2]);return"+"===d[0]?-e:e}function R(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Bb]=3*(A(b)-1));break;case"M":case"MM":null!=b&&(e[Bb]=A(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b),null!=d?e[Bb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Cb]=A(b));break;case"Do":null!=b&&(e[Cb]=A(parseInt(b,10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=A(b));break;case"YY":e[Ab]=tb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Ab]=A(b);break;case"a":case"A":c._isPm=c._locale.isPM(b);break;case"H":case"HH":case"h":case"hh":e[Db]=A(b);break;case"m":case"mm":e[Eb]=A(b);break;case"s":case"ss":e[Fb]=A(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Gb]=A(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=Q(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=A(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=tb.parseTwoDigitYear(b)}}function S(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Ab],hb(tb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Ab],hb(tb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=ib(d,e,f,h,g),a._a[Ab]=i.year,a._dayOfYear=i.dayOfYear}function T(a){var c,d,e,f,g=[];if(!a._d){for(e=V(a),a._w&&null==a._a[Cb]&&null==a._a[Bb]&&S(a),a._dayOfYear&&(f=b(a._a[Ab],e[Ab]),a._dayOfYear>D(f)&&(a._pf._overflowDayOfYear=!0),d=db(f,0,a._dayOfYear),a._a[Bb]=d.getUTCMonth(),a._a[Cb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];a._d=(a._useUTC?db:cb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm)}}function U(a){var b;a._d||(b=y(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],T(a))}function V(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function W(a){if(a._f===tb.ISO_8601)return void $(a);a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=""+a._i,h=g.length,i=0;for(d=O(a._f,a._locale).match(Nb)||[],b=0;b0&&a._pf.unusedInput.push(f),g=g.slice(g.indexOf(c)+c.length),i+=c.length),pc[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),R(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=h-i,g.length>0&&a._pf.unusedInput.push(g),a._isPm&&a._a[Db]<12&&(a._a[Db]+=12),a._isPm===!1&&12===a._a[Db]&&(a._a[Db]=0),T(a),F(a)}function X(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function Y(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,c=b));m(a,c||b)}function $(a){var b,c,d=a._i,e=dc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=fc.length;c>b;b++)if(fc[b][1].exec(d)){a._f=fc[b][0]+(e[6]||" ");break}for(b=0,c=gc.length;c>b;b++)if(gc[b][1].exec(d)){a._f+=gc[b][0];break}d.match(Vb)&&(a._f+="Z"),W(a)}else a._isValid=!1}function _(a){$(a),a._isValid===!1&&(delete a._isValid,tb.createFromInputFallback(a))}function ab(a,b){var c,d=[];for(c=0;ca&&h.setFullYear(a),h}function db(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function eb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function fb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function gb(a,b,c){var d=tb.duration(a).abs(),e=yb(d.as("s")),f=yb(d.as("m")),g=yb(d.as("h")),h=yb(d.as("d")),i=yb(d.as("M")),j=yb(d.as("y")),k=e0,k[4]=c,fb.apply({},k)}function hb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=tb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ib(a,b,c,d,e){var f,g,h=db(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:D(a-1)+g}}function jb(b){var c=b._i,d=b._f;return b._locale=b._locale||tb.localeData(b._l),null===c||d===a&&""===c?tb.invalid({nullInput:!0}):("string"==typeof c&&(b._i=c=b._locale.preparse(c)),tb.isMoment(c)?new k(c,!0):(d?u(d)?Z(b):W(b):bb(b),new k(b)))}function kb(a,b){var c,d;if(1===b.length&&u(b[0])&&(b=b[0]),!b.length)return tb();for(c=b[0],d=1;d=0?"+":"-";return b+p(Math.abs(a),6)},gg:function(){return p(this.weekYear()%100,2)},gggg:function(){return p(this.weekYear(),4)},ggggg:function(){return p(this.weekYear(),5)},GG:function(){return p(this.isoWeekYear()%100,2)},GGGG:function(){return p(this.isoWeekYear(),4)},GGGGG:function(){return p(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return A(this.milliseconds()/100)},SS:function(){return p(A(this.milliseconds()/10),2)},SSS:function(){return p(this.milliseconds(),3)},SSSS:function(){return p(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+":"+p(A(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+p(A(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},qc={},rc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];nc.length;)vb=nc.pop(),pc[vb+"o"]=i(pc[vb],vb);for(;oc.length;)vb=oc.pop(),pc[vb+vb]=h(pc[vb],2);pc.DDDD=h(pc.DDD,3),m(j.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=tb.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=tb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return hb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),tb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),jb(g)},tb.suppressDeprecationWarnings=!1,tb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)}),tb.min=function(){var a=[].slice.call(arguments,0);return kb("isBefore",a)},tb.max=function(){var a=[].slice.call(arguments,0);return kb("isAfter",a)},tb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),jb(g).utc()},tb.unix=function(a){return tb(1e3*a)},tb.duration=function(a,b){var d,e,f,g,h=a,i=null;return tb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Lb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:A(i[Cb])*d,h:A(i[Db])*d,m:A(i[Eb])*d,s:A(i[Fb])*d,ms:A(i[Gb])*d}):(i=Mb.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):"object"==typeof h&&("from"in h||"to"in h)&&(g=r(tb(h.from),tb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new l(h),tb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},tb.version=wb,tb.defaultFormat=ec,tb.ISO_8601=function(){},tb.momentProperties=Ib,tb.updateOffset=function(){},tb.relativeTimeThreshold=function(b,c){return mc[b]===a?!1:c===a?mc[b]:(mc[b]=c,!0)},tb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return tb.locale(a,b)}),tb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?tb.defineLocale(a,b):tb.localeData(a),c&&(tb.duration._locale=tb._locale=c)),tb._locale._abbr},tb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Hb[a]||(Hb[a]=new j),Hb[a].set(b),tb.locale(a),Hb[a]):(delete Hb[a],null)},tb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return tb.localeData(a)}),tb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return tb._locale;if(!u(a)){if(b=J(a))return b;a=[a]}return I(a)},tb.isMoment=function(a){return a instanceof k||null!=a&&c(a,"_isAMomentObject")},tb.isDuration=function(a){return a instanceof l};for(vb=rc.length-1;vb>=0;--vb)z(rc[vb]);tb.normalizeUnits=function(a){return x(a)},tb.invalid=function(a){var b=tb.utc(0/0);return null!=a?m(b._pf,a):b._pf.userInvalidated=!0,b},tb.parseZone=function(){return tb.apply(null,arguments).parseZone()},tb.parseTwoDigitYear=function(a){return A(a)+(A(a)>68?1900:2e3)},m(tb.fn=k.prototype,{clone:function(){return tb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=tb(this).utc();return 00:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.zone(0,a)},local:function(a){return this._isUTC&&(this.zone(0,a),this._isUTC=!1,a&&this.add(this._dateTzOffset(),"m")),this},format:function(a){var b=N(this,a||tb.defaultFormat);return this.localeData().postformat(b)},add:s(1,"add"),subtract:s(-1,"subtract"),diff:function(a,b,c){var d,e,f,g=K(a,this),h=6e4*(this.zone()-g.zone());return b=x(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+g.daysInMonth()),e=12*(this.year()-g.year())+(this.month()-g.month()),f=this-tb(this).startOf("month")-(g-tb(g).startOf("month")),f-=6e4*(this.zone()-tb(this).startOf("month").zone()-(g.zone()-tb(g).startOf("month").zone())),e+=f/d,"year"===b&&(e/=12)):(d=this-g,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-h)/864e5:"week"===b?(d-h)/6048e5:d),c?e:o(e)},from:function(a,b){return tb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(tb(),a)},calendar:function(a){var b=a||tb(),c=K(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this))},isLeapYear:function(){return E(this.year())},isDST:function(){return this.zone()+a):+this.clone().startOf(b)>+tb(a).startOf(b)},isBefore:function(a,b){return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+a>+this):+this.clone().startOf(b)<+tb(a).startOf(b)},isSame:function(a,b){return b=x(b||"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this===+a):+this.clone().startOf(b)===+K(a,this).startOf(b)},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),a>this?this:a}),zone:function(a,b){var c,d=this._offset||0;return null==a?this._isUTC?d:this._dateTzOffset():("string"==typeof a&&(a=Q(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateTzOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.subtract(c,"m"),d!==a&&(!b||this._changeInProgress?t(this,tb.duration(d-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,tb.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?tb(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return B(this.year(),this.month())},dayOfYear:function(a){var b=yb((tb(this).startOf("day")-tb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=hb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=hb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=hb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return C(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return C(this.year(),a.dow,a.doy)},get:function(a){return a=x(a),this[a]()},set:function(a,b){return a=x(a),"function"==typeof this[a]&&this[a](b),this},locale:function(b){var c;return b===a?this._locale._abbr:(c=tb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Use moment().localeData() instead.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),tb.fn.millisecond=tb.fn.milliseconds=ob("Milliseconds",!1),tb.fn.second=tb.fn.seconds=ob("Seconds",!1),tb.fn.minute=tb.fn.minutes=ob("Minutes",!1),tb.fn.hour=tb.fn.hours=ob("Hours",!0),tb.fn.date=ob("Date",!0),tb.fn.dates=f("dates accessor is deprecated. Use date instead.",ob("Date",!0)),tb.fn.year=ob("FullYear",!0),tb.fn.years=f("years accessor is deprecated. Use year instead.",ob("FullYear",!0)),tb.fn.days=tb.fn.day,tb.fn.months=tb.fn.month,tb.fn.weeks=tb.fn.week,tb.fn.isoWeeks=tb.fn.isoWeek,tb.fn.quarters=tb.fn.quarter,tb.fn.toJSON=tb.fn.toISOString,m(tb.duration.fn=l.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=o(d/1e3),g.seconds=a%60,b=o(a/60),g.minutes=b%60,c=o(b/60),g.hours=c%24,e+=o(c/24),h=o(pb(e)),e-=o(qb(h)),f+=o(e/30),e%=30,h+=o(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*A(this._months/12)},humanize:function(a){var b=gb(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=tb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=tb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=x(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=x(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*pb(b),"month"===a?c:c/12;switch(b=this._days+qb(this._months/12),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:tb.fn.lang,locale:tb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale}}),tb.duration.fn.toString=tb.duration.fn.toISOString;for(vb in ic)c(ic,vb)&&rb(vb.toLowerCase());tb.duration.fn.asMilliseconds=function(){return this.as("ms")},tb.duration.fn.asSeconds=function(){return this.as("s")},tb.duration.fn.asMinutes=function(){return this.as("m")},tb.duration.fn.asHours=function(){return this.as("h")},tb.duration.fn.asDays=function(){return this.as("d")},tb.duration.fn.asWeeks=function(){return this.as("weeks")},tb.duration.fn.asMonths=function(){return this.as("M")},tb.duration.fn.asYears=function(){return this.as("y")},tb.locale("en",{ordinal:function(a){var b=a%10,c=1===A(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"; return a+c}}),Jb?module.exports=tb:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(xb.moment=ub),tb}),sb(!0)):sb()}).call(this); // source --> https://www.responsenet.org/wp-content/plugins/wp-facebook-feed/includes/../js/jquery.socialfeed.js?ver=5.2.4 /*! * imagesLoaded PACKAGED v4.1.1 * JavaScript is all like "You images are done yet or what?" * MIT License */ !function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}(window,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;ie;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!c){c=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s.isBoxSizeOuter=r=200==t(o.width),i.removeChild(e)}}function s(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var s=n(e);if("none"==s.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var c=a.isBorderBox="border-box"==s.boxSizing,d=0;u>d;d++){var f=h[d],l=s[f],p=parseFloat(l);a[f]=isNaN(p)?0:p}var g=a.paddingLeft+a.paddingRight,m=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,x=a.borderTopWidth+a.borderBottomWidth,b=c&&r,E=t(s.width);E!==!1&&(a.width=E+(b?0:g+_));var T=t(s.height);return T!==!1&&(a.height=T+(b?0:m+x)),a.innerWidth=a.width-(g+_),a.innerHeight=a.height-(m+x),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,c=!1;return s}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),n+=r?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i=t.x+e&&this.y+this.height>=t.y+i},e.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,o=t.y+t.height;return this.xt.x&&this.yt.y},e.getMaximalFreeRects=function(e){if(!this.overlaps(e))return!1;var i,n=[],o=this.x+this.width,s=this.y+this.height,r=e.x+e.width,a=e.y+e.height;return this.yr&&(i=new t({x:r,y:this.y,width:o-r,height:this.height}),n.push(i)),s>a&&(i=new t({x:this.x,y:a,width:this.width,height:s-a}),n.push(i)),this.x=t.width&&this.height>=t.height},t}),function(t,e){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],e);else if("object"==typeof module&&module.exports)module.exports=e(require("./rect"));else{var i=t.Packery=t.Packery||{};i.Packer=e(i.Rect)}}(window,function(t){"use strict";function e(t,e,i){this.width=t||0,this.height=e||0,this.sortDirection=i||"downwardLeftToRight",this.reset()}var i=e.prototype;i.reset=function(){this.spaces=[];var e=new t({x:0,y:0,width:this.width,height:this.height});this.spaces.push(e),this.sorter=n[this.sortDirection]||n.downwardLeftToRight},i.pack=function(t){for(var e=0;e=t.x+t.width&&i.height>=t.height-.01;if(n){t.y=i.y,this.placed(t);break}}},i.rowPack=function(t){for(var e=0;e=t.y+t.height&&i.width>=t.width-.01;if(n){t.x=i.x,this.placed(t);break}}},i.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},i.placed=function(t){for(var e=[],i=0;ii&&1>n;return o?void this.goTo(t,e):void a.apply(this,arguments)},s.enablePlacing=function(){this.removeTransitionStyles(),this.isTransitioning&&n&&(this.element.style[n]="none"),this.isTransitioning=!1,this.getSize(),this.layout._setRectSize(this.element,this.rect),this.isPlacing=!0},s.disablePlacing=function(){this.isPlacing=!1},s.removeElem=function(){this.element.parentNode.removeChild(this.element),this.layout.packer.addSpace(this.rect),this.emitEvent("remove",[this])},s.showDropPlaceholder=function(){var t=this.dropPlaceholder;t||(t=this.dropPlaceholder=document.createElement("div"),t.className="packery-drop-placeholder",t.style.position="absolute"),t.style.width=this.size.width+"px",t.style.height=this.size.height+"px",this.positionDropPlaceholder(),this.layout.element.appendChild(t)},s.positionDropPlaceholder=function(){this.dropPlaceholder.style[n]="translate("+this.rect.x+"px, "+this.rect.y+"px)"},s.hideDropPlaceholder=function(){var t=this.dropPlaceholder.parentNode;t&&t.removeChild(this.dropPlaceholder)},o}),function(t,e){"function"==typeof define&&define.amd?define(["get-size/get-size","outlayer/outlayer","packery/js/rect","packery/js/packer","packery/js/item"],e):"object"==typeof module&&module.exports?module.exports=e(require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):t.Packery=e(t.getSize,t.Outlayer,t.Packery.Rect,t.Packery.Packer,t.Packery.Item)}(window,function(t,e,i,n,o){"use strict";function s(t,e){return t.position.y-e.position.y||t.position.x-e.position.x}function r(t,e){return t.position.x-e.position.x||t.position.y-e.position.y}function a(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)}i.prototype.canFit=function(t){return this.width>=t.width-1&&this.height>=t.height-1};var h=e.create("packery");h.Item=o;var u=h.prototype;u._create=function(){e.prototype._create.call(this),this.packer=new n,this.shiftPacker=new n,this.isEnabled=!0,this.dragItemCount=0;var t=this;this.handleDraggabilly={dragStart:function(){t.itemDragStart(this.element)},dragMove:function(){t.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){t.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(e,i){i&&t.itemDragStart(e.currentTarget)},drag:function(e,i){i&&t.itemDragMove(e.currentTarget,i.position.left,i.position.top)},stop:function(e,i){i&&t.itemDragEnd(e.currentTarget)}}},u._resetLayout=function(){this.getSize(),this._getMeasurements();var t,e,i;this._getOption("horizontal")?(t=1/0,e=this.size.innerHeight+this.gutter,i="rightwardTopToBottom"):(t=this.size.innerWidth+this.gutter,e=1/0,i="downwardLeftToRight"),this.packer.width=this.shiftPacker.width=t,this.packer.height=this.shiftPacker.height=e,this.packer.sortDirection=this.shiftPacker.sortDirection=i,this.packer.reset(),this.maxY=0,this.maxX=0},u._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},u._getItemLayoutPosition=function(t){if(this._setRectSize(t.element,t.rect),this.isShifting||this.dragItemCount>0){var e=this._getPackMethod();this.packer[e](t.rect)}else this.packer.pack(t.rect);return this._setMaxXY(t.rect),t.rect},u.shiftLayout=function(){this.isShifting=!0,this.layout(),delete this.isShifting},u._getPackMethod=function(){return this._getOption("horizontal")?"rowPack":"columnPack"},u._setMaxXY=function(t){this.maxX=Math.max(t.x+t.width,this.maxX),this.maxY=Math.max(t.y+t.height,this.maxY)},u._setRectSize=function(e,i){var n=t(e),o=n.outerWidth,s=n.outerHeight;(o||s)&&(o=this._applyGridGutter(o,this.columnWidth),s=this._applyGridGutter(s,this.rowHeight)),i.width=Math.min(o,this.packer.width),i.height=Math.min(s,this.packer.height)},u._applyGridGutter=function(t,e){if(!e)return t+this.gutter;e+=this.gutter;var i=t%e,n=i&&1>i?"round":"ceil";return t=Math[n](t/e)*e},u._getContainerSize=function(){return this._getOption("horizontal")?{width:this.maxX-this.gutter}:{height:this.maxY-this.gutter}},u._manageStamp=function(t){var e,n=this.getItem(t);if(n&&n.isPlacing)e=n.rect;else{var o=this._getElementOffset(t);e=new i({x:this._getOption("originLeft")?o.left:o.right,y:this._getOption("originTop")?o.top:o.bottom})}this._setRectSize(t,e),this.packer.placed(e),this._setMaxXY(e)},u.sortItemsByPosition=function(){var t=this._getOption("horizontal")?r:s;this.items.sort(t)},u.fit=function(t,e,i){var n=this.getItem(t);n&&(this.stamp(n.element),n.enablePlacing(),this.updateShiftTargets(n),e=void 0===e?n.rect.x:e,i=void 0===i?n.rect.y:i,this.shift(n,e,i),this._bindFitEvents(n),n.moveTo(n.rect.x,n.rect.y),this.shiftLayout(),this.unstamp(n.element),this.sortItemsByPosition(),n.disablePlacing())},u._bindFitEvents=function(t){function e(){n++,2==n&&i.dispatchEvent("fitComplete",null,[t])}var i=this,n=0;t.once("layout",e),this.once("layoutComplete",e)},u.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&(this.options.shiftPercentResize?this.resizeShiftPercentLayout():this.layout())},u.needsResizeLayout=function(){var e=t(this.element),i=this._getOption("horizontal")?"innerHeight":"innerWidth";return e[i]!=this.size[i]},u.resizeShiftPercentLayout=function(){var e=this._getItemsForLayout(this.items),i=this._getOption("horizontal"),n=i?"y":"x",o=i?"height":"width",s=i?"rowHeight":"columnWidth",r=i?"innerHeight":"innerWidth",a=this[s];if(a=a&&a+this.gutter){this._getMeasurements();var h=this[s]+this.gutter;e.forEach(function(t){var e=Math.round(t.rect[n]/a);t.rect[n]=e*h})}else{var u=t(this.element)[r]+this.gutter,c=this.packer[o];e.forEach(function(t){t.rect[n]=t.rect[n]/c*u})}this.shiftLayout()},u.itemDragStart=function(t){if(this.isEnabled){this.stamp(t);var e=this.getItem(t);e&&(e.enablePlacing(),e.showDropPlaceholder(),this.dragItemCount++,this.updateShiftTargets(e))}},u.updateShiftTargets=function(t){this.shiftPacker.reset(),this._getBoundingRect();var e=this._getOption("originLeft"),n=this._getOption("originTop");this.stamps.forEach(function(t){var o=this.getItem(t);if(!o||!o.isPlacing){var s=this._getElementOffset(t),r=new i({x:e?s.left:s.right,y:n?s.top:s.bottom});this._setRectSize(t,r),this.shiftPacker.placed(r)}},this);var o=this._getOption("horizontal"),s=o?"rowHeight":"columnWidth",r=o?"height":"width";this.shiftTargetKeys=[],this.shiftTargets=[];var a,h=this[s];if(h=h&&h+this.gutter){var u=Math.ceil(t.rect[r]/h),c=Math.floor((this.shiftPacker[r]+this.gutter)/h);a=(c-u)*h;for(var d=0;c>d;d++){var f=o?0:d*h,l=o?d*h:0;this._addShiftTarget(f,l,a)}}else a=this.shiftPacker[r]+this.gutter-t.rect[r],this._addShiftTarget(0,0,a);var p=this._getItemsForLayout(this.items),g=this._getPackMethod();p.forEach(function(t){var e=t.rect;this._setRectSize(t.element,e),this.shiftPacker[g](e),this._addShiftTarget(e.x,e.y,a);var i=o?e.x+e.width:e.x,n=o?e.y:e.y+e.height;if(this._addShiftTarget(i,n,a),h)for(var s=Math.round(e[r]/h),u=1;s>u;u++){var c=o?i:e.x+h*u,d=o?e.y+h*u:n;this._addShiftTarget(c,d,a)}},this)},u._addShiftTarget=function(t,e,i){var n=this._getOption("horizontal")?e:t;if(!(0!==n&&n>i)){var o=t+","+e,s=-1!=this.shiftTargetKeys.indexOf(o);s||(this.shiftTargetKeys.push(o),this.shiftTargets.push({x:t,y:e}))}},u.shift=function(t,e,i){var n,o=1/0,s={x:e,y:i};this.shiftTargets.forEach(function(t){var e=a(t,s);o>e&&(n=t,o=e)}),t.rect.x=n.x,t.rect.y=n.y};var c=120;u.itemDragMove=function(t,e,i){ function n(){s.shift(o,e,i),o.positionDropPlaceholder(),s.layout()}var o=this.isEnabled&&this.getItem(t);if(o){e-=this.size.paddingLeft,i-=this.size.paddingTop;var s=this,r=new Date;this._itemDragTime&&r-this._itemDragTime0)c?e+=r+s:e-=i+k+l+m;else{e=h[b];if(e<0||e===null)e=a.style[b]||0;e=parseFloat(e)||0,c&&(e+=i+k+r+s+l+m)}return e}function q(b,c,d){b.addEventListener?b.addEventListener(c,d,!1):b.attachEvent&&(b["e"+c+d]=d,b[c+d]=function(){b["e"+c+d](a.event)},b.attachEvent("on"+c,b[c+d]))}function r(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&(a.detachEvent("on"+b,a[b+c]),a[b+c]=null,a["e"+b+c]=null)}function s(a,b){if(!a)return;this.element=a,this.options={};for(var c in s.defaults)this.options[c]=s.defaults[c];for(c in b)this.options[c]=b[c];this._create(),this.build()}"use strict";var c=a.document,d="classList"in c.createElement("div"),f=d?function(a,b){return a.classList.contains(b)}:function(a,b){return e(b).test(a.className)},g=d?function(a,b){a.classList.add(b)}:function(a,b){f(a,b)||(a.className=a.className+" "+b)},h=d?function(a,b){a.classList.remove(b)}:function(a,b){a.className=a.className.replace(e(b)," ")},i=c.defaultView,j=i&&i.getComputedStyle?function(a){return i.getComputedStyle(a,null)}:function(a){return a.currentStyle},k=c.getElementsByTagName("body")[0],l=c.createElement("div"),m=k||c.createElement("body");l.style.marginTop="1%",m.appendChild(l);var n=j(l).marginTop!=="1%";m.removeChild(l);var t=["position","height"];s.defaults={isResizable:!0,gutterWidth:0,isRTL:!1,isFitWidth:!1},s.prototype={_getBricks:function(a){var b;for(var c=0,d=a.length;c 0) fire = false; });*/ if (fire && options.callback) { options.callback(); } } var Utility = { request: function(url, callback) { $.ajax({ url: url, dataType: 'jsonp', success: callback }); }, get_request: function(url, callback) { $.get(url, callback, 'json'); }, wrapLinks: function(string, social_network) { var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; if (social_network === 'google-plus') { string = string.replace(/(@|#)([a-z0-9_]+['])/ig, Utility.wrapGoogleplusTagTemplate); } else { string = string.replace(exp, Utility.wrapLinkTemplate); } return string; }, wrapLinkTemplate: function(string) { return '' + string + '<\/a>'; }, wrapGoogleplusTagTemplate: function(string) { return '' + string + '<\/a>'; }, shorten: function(string) { string = $.trim(string); if (string.length > options.length) { return jQuery.trim(string).substring(0, options.length).split(" ").slice(0, -1).join(" ") + "..."; } else { return string; } }, stripHTML: function(string) { if (typeof string === "undefined" || string === null) { return ''; } return string.replace(/(<([^>]+)>)|nbsp;|\s{2,}|/ig, ""); } }; function SocialFeedPost(social_network, data) { this.content = data; this.content.social_network = social_network; this.content.attachment = (this.content.attachment === undefined) ? '' : this.content.attachment; this.content.time_ago = data.dt_create.fromNow(); this.content.date = data.dt_create.format(options.date_format); this.content.dt_create = this.content.dt_create.valueOf(); this.content.text = Utility.wrapLinks(Utility.shorten(data.message + ' ' + data.description), data.social_network); this.content.moderation_passed = (options.moderation) ? options.moderation(this.content) : true; Feed[social_network].posts.push(this); } SocialFeedPost.prototype = { render: function() { var rendered_html = Feed.template(this.content); var data = this.content; if ($(container).children('[social-feed-id=' + data.id + ']').length !== 0) { return false; } if ($(container).children().length === 0) { $(container).append(rendered_html); } else { var i = 0, insert_index = -1; $.each($(container).children(), function() { if ($(this).attr('dt-create') < data.dt_create) { insert_index = i; return false; } i++; }); $(container).append(rendered_html); if (insert_index >= 0) { insert_index++; var before = $(container).children('div:nth-child(' + insert_index + ')'), current = $(container).children('div:last-child'); $(current).insertBefore(before); } } if (options.media_min_width) { var query = '[social-feed-id=' + data.id + '] img.attachment'; var image = $(query); // preload the image var height, width = ''; var img = new Image(); var imgSrc = image.attr("src"); $(img).load(function() { if (img.width < options.media_min_width) { image.hide(); } // garbage collect img delete img; }).error(function() { // image couldnt be loaded image.hide(); }).attr({ src: imgSrc }); } loaded_post_count++; if (loaded_post_count == posts_to_load_count) { fireCallback(); } } }; var Feed = { template: false, init: function() { Feed.getTemplate(function() { social_networks.forEach(function(network) { if (options[network]) { if ( options[network].accounts ) { //loaded[network] = 0; options[network].accounts.forEach(function(account) { //loaded[network]++; Feed[network].getData(account); }); } else if ( options[network].urls ) { options[network].urls.forEach(function(url) { Feed[network].getData(url); }); } else { Feed[network].getData(); } } }); }); }, getTemplate: function(callback) { if (Feed.template) return callback(); else { if (options.template_html) { Feed.template = doT.template(options.template_html); return callback(); } else { $.get(options.template, function(template_html) { Feed.template = doT.template(template_html); return callback(); }); } } }, twitter: { posts: [], loaded: false, api: 'http://api.tweecool.com/', getData: function(account) { var cb = new Codebird(); cb.setConsumerKey(options.twitter.consumer_key, options.twitter.consumer_secret); // Allow setting your own proxy with Codebird if (options.twitter.proxy !== undefined) { cb.setProxy(options.twitter.proxy); } switch (account[0]) { case '@': var userid = account.substr(1); cb.__call( "statuses_userTimeline", "id=" + userid + "&count=" + options.twitter.limit, Feed.twitter.utility.getPosts, true // this parameter required ); break; case '#': var hashtag = account.substr(1); cb.__call( "search_tweets", "q=" + hashtag + "&count=" + options.twitter.limit, function(reply) { Feed.twitter.utility.getPosts(reply.statuses); }, true // this parameter required ); break; default: } }, utility: { getPosts: function(json) { if (json) { $.each(json, function() { var element = this; var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element)); post.render(); }); } }, unifyPostData: function(element) { var post = {}; if (element.id) { post.id = element.id; //prevent a moment.js console warning due to Twitter's poor date format. post.dt_create = moment(new Date(element.created_at)); post.author_link = 'http://twitter.com/' + element.user.screen_name; post.author_picture = element.user.profile_image_url; post.post_url = post.author_link + '/status/' + element.id_str; post.author_name = element.user.name; post.message = element.text; post.description = ''; post.link = 'http://twitter.com/' + element.user.screen_name + '/status/' + element.id_str; if (options.show_media === true) { if (element.entities.media && element.entities.media.length > 0) { var image_url = element.entities.media[0].media_url; if (image_url) { post.attachment = ''; } } } } return post; } } }, facebook: { posts: [], graph: 'https://graph.facebook.com/', loaded: false, getData: function(account) { var proceed = function(request_url){ Utility.request(request_url, Feed.facebook.utility.getPosts); }; var fields = '?fields=id,from,name,message,created_time,story,description,link'; fields += (options.show_media === true)?',picture,object_id':''; var request_url, limit = '&limit=' + options.facebook.limit, query_extention = '&access_token=' + options.facebook.access_token + '&callback=?'; switch (account[0]) { case '@': var username = account.substr(1); Feed.facebook.utility.getUserId(username, function(userdata) { if (userdata.id !== '') { request_url = Feed.facebook.graph + 'v2.4/' + userdata.id + '/posts'+ fields + limit + query_extention; proceed(request_url); } }); break; case '!': var page = account.substr(1); request_url = Feed.facebook.graph + 'v2.4/' + page + '/feed'+ fields + limit + query_extention; proceed(request_url); break; default: proceed(request_url); } }, utility: { getUserId: function(username, callback) { var query_extention = '&access_token=' + options.facebook.access_token + '&callback=?'; var url = 'https://graph.facebook.com/' + username + '?' + query_extention; var result = ''; $.get(url, callback, 'json'); }, prepareAttachment: function(element) { var image_url = element.picture; if (image_url.indexOf('_b.') !== -1) { //do nothing it is already big } else if (image_url.indexOf('safe_image.php') !== -1) { image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'url'); } else if (image_url.indexOf('app_full_proxy.php') !== -1) { image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'src'); } else if (element.object_id) { image_url = Feed.facebook.graph + element.object_id + '/picture/?type=normal'; } return ''; }, getExternalImageURL: function(image_url, parameter) { image_url = decodeURIComponent(image_url).split(parameter + '=')[1]; if (image_url.indexOf('fbcdn-sphotos') === -1) { return image_url.split('&')[0]; } else { return image_url; } }, getPosts: function(json) { if (json['data']) { json['data'].forEach(function(element) { var post = new SocialFeedPost('facebook', Feed.facebook.utility.unifyPostData(element)); post.render(); }); } }, unifyPostData: function(element) { var post = {}, text = (element.message) ? element.message : element.story; post.id = element.id; post.dt_create = moment(element.created_time); post.author_link = 'http://facebook.com/' + element.from.id; post.author_picture = Feed.facebook.graph + element.from.id + '/picture'; post.author_name = element.from.name; post.name = element.name || ""; post.message = (text) ? text : ''; post.description = (element.description) ? element.description : ''; post.link = (element.link) ? element.link : 'http://facebook.com/' + element.from.id; if (options.show_media === true) { if (element.picture) { var attachment = Feed.facebook.utility.prepareAttachment(element); if (attachment) { post.attachment = attachment; } } } return post; } } }, google: { posts: [], loaded: false, api: 'https://www.googleapis.com/plus/v1/', getData: function(account) { var request_url; switch (account[0]) { case '#': var hashtag = account.substr(1); request_url = Feed.google.api + 'activities?query=' + hashtag + '&key=' + options.google.access_token + '&maxResults=' + options.google.limit; Utility.get_request(request_url, Feed.google.utility.getPosts); break; case '@': var username = account.substr(1); request_url = Feed.google.api + 'people/' + username + '/activities/public?key=' + options.google.access_token + '&maxResults=' + options.google.limit; Utility.get_request(request_url, Feed.google.utility.getPosts); break; default: } }, utility: { getPosts: function(json) { if (json.items) { $.each(json.items, function(i) { var post = new SocialFeedPost('google', Feed.google.utility.unifyPostData(json.items[i])); post.render(); }); } }, unifyPostData: function(element) { var post = {}; post.id = element.id; post.attachment = ''; post.description = ''; post.dt_create = moment(element.published); post.author_link = element.actor.url; post.author_picture = element.actor.image.url; post.author_name = element.actor.displayName; if (options.show_media === true) { if (element.object.attachments) { $.each(element.object.attachments, function() { var image = ''; if (this.fullImage) { image = this.fullImage.url; } else { if (this.objectType === 'album') { if (this.thumbnails && this.thumbnails.length > 0) { if (this.thumbnails[0].image) { image = this.thumbnails[0].image.url; } } } } post.attachment = ''; }); } } post.message = element.title; post.link = element.url; return post; } } }, instagram: { posts: [], api: 'https://api.instagram.com/v1/', loaded: false, accessType: function() { // If we have both the client_id and access_token set in options, // use access_token for authentication. If client_id is not set // then use access_token. If neither are set, log an error to console. if (typeof options.instagram.access_token === 'undefined' && typeof options.instagram.client_id === 'undefined') { console.log('You need to define a client_id or access_token to authenticate with Instagram\'s API.'); return undefined; } if (options.instagram.access_token) { options.instagram.client_id = undefined; } options.instagram.access_type = (typeof options.instagram.client_id === 'undefined' ? 'access_token' : 'client_id'); return options.instagram.access_type; }, getData: function(account) { var url; // API endpoint URL depends on which authentication type we're using. if (this.accessType() !== 'undefined') { var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type]; } switch (account[0]) { case '@': var username = account.substr(1); url = Feed.instagram.api + 'users/search/?q=' + username + '&' + authTokenParams + '&count=1' + '&callback=?'; Utility.request(url, Feed.instagram.utility.getUsers); break; case '#': var hashtag = account.substr(1); url = Feed.instagram.api + 'tags/' + hashtag + '/media/recent/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?'; Utility.request(url, Feed.instagram.utility.getImages); break; case '&': var id = account.substr(1); url = Feed.instagram.api + 'users/' + id + '/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?'; Utility.request(url, Feed.instagram.utility.getUsers); default: } }, utility: { getImages: function(json) { if (json.data) { json.data.forEach(function(element) { var post = new SocialFeedPost('instagram', Feed.instagram.utility.unifyPostData(element)); post.render(); }); } }, getUsers: function(json) { // API endpoint URL depends on which authentication type we're using. if (options.instagram.access_type !== 'undefined') { var authTokenParams = options.instagram.access_type + '=' + options.instagram[options.instagram.access_type]; } if (!jQuery.isArray(json.data)) json.data = [json.data] json.data.forEach(function(user) { var url = Feed.instagram.api + 'users/' + user.id + '/media/recent/?' + authTokenParams + '&' + 'count=' + options.instagram.limit + '&callback=?'; Utility.request(url, Feed.instagram.utility.getImages); }); }, unifyPostData: function(element) { var post = {}; post.id = element.id; post.dt_create = moment(element.created_time * 1000); post.author_link = 'http://instagram.com/' + element.user.username; post.author_picture = element.user.profile_picture; post.author_name = element.user.full_name || element.user.username; post.message = (element.caption && element.caption) ? element.caption.text : ''; post.description = ''; post.link = element.link; if (options.show_media) { post.attachment = ''; } return post; } } }, vk: { posts: [], loaded: false, base: 'http://vk.com/', api: 'https://api.vk.com/method/', user_json_template: 'https://api.vk.com/method/' + 'users.get?fields=first_name,%20last_name,%20screen_name,%20photo&uid=', group_json_template: 'https://api.vk.com/method/' + 'groups.getById?fields=first_name,%20last_name,%20screen_name,%20photo&gid=', getData: function(account) { var request_url; switch (account[0]) { case '@': var username = account.substr(1); request_url = Feed.vk.api + 'wall.get?owner_id=' + username + '&filter=' + options.vk.source + '&count=' + options.vk.limit + '&callback=?'; Utility.get_request(request_url, Feed.vk.utility.getPosts); break; case '#': var hashtag = account.substr(1); request_url = Feed.vk.api + 'newsfeed.search?q=' + hashtag + '&count=' + options.vk.limit + '&callback=?'; Utility.get_request(request_url, Feed.vk.utility.getPosts); break; default: } }, utility: { getPosts: function(json) { if (json.response) { $.each(json.response, function() { if (this != parseInt(this) && this.post_type === 'post') { var owner_id = (this.owner_id) ? this.owner_id : this.from_id, vk_wall_owner_url = (owner_id > 0) ? (Feed.vk.user_json_template + owner_id + '&callback=?') : (Feed.vk.group_json_template + (-1) * owner_id + '&callback=?'), element = this; Utility.get_request(vk_wall_owner_url, function(wall_owner) { Feed.vk.utility.unifyPostData(wall_owner, element, json); }); } }); } }, unifyPostData: function(wall_owner, element, json) { var post = {}; post.id = element.id; post.dt_create = moment.unix(element.date); post.description = ' '; post.message = Utility.stripHTML(element.text); if (options.show_media) { if (element.attachment) { if (element.attachment.type === 'link') post.attachment = ''; if (element.attachment.type === 'video') post.attachment = ''; if (element.attachment.type === 'photo') post.attachment = ''; } } if (element.from_id > 0) { var vk_user_json = Feed.vk.user_json_template + element.from_id + '&callback=?'; Utility.get_request(vk_user_json, function(user_json) { var vk_post = new SocialFeedPost('vk', Feed.vk.utility.getUser(user_json, post, element, json)); vk_post.render(); }); } else { var vk_group_json = Feed.vk.group_json_template + (-1) * element.from_id + '&callback=?'; Utility.get_request(vk_group_json, function(user_json) { var vk_post = new SocialFeedPost('vk', Feed.vk.utility.getGroup(user_json, post, element, json)); vk_post.render(); }); } }, getUser: function(user_json, post, element, json) { post.author_name = user_json.response[0].first_name + ' ' + user_json.response[0].last_name; post.author_picture = user_json.response[0].photo; post.author_link = Feed.vk.base + user_json.response[0].screen_name; post.link = Feed.vk.base + user_json.response[0].screen_name + '?w=wall' + element.from_id + '_' + element.id; return post; }, getGroup: function(user_json, post, element, json) { post.author_name = user_json.response[0].name; post.author_picture = user_json.response[0].photo; post.author_link = Feed.vk.base + user_json.response[0].screen_name; post.link = Feed.vk.base + user_json.response[0].screen_name + '?w=wall-' + user_json.response[0].gid + '_' + element.id; return post; } } }, blogspot: { loaded: false, getData: function(account) { var url; switch (account[0]) { case '@': var username = account.substr(1); url = 'http://' + username + '.blogspot.com/feeds/posts/default?alt=json-in-script&callback=?'; request(url, getPosts); break; default: } }, utility: { getPosts: function(json) { $.each(json.feed.entry, function() { var post = {}, element = this; post.id = element.id['$t'].replace(/[^a-z0-9]/gi, ''); post.dt_create = moment((element.published['$t'])); post.author_link = element.author[0]['uri']['$t']; post.author_picture = 'http:' + element.author[0]['gd$image']['src']; post.author_name = element.author[0]['name']['$t']; post.message = element.title['$t'] + '

      ' + stripHTML(element.content['$t']); post.description = ''; post.link = element.link.pop().href; if (options.show_media) { if (element['media$thumbnail']) { post.attachment = ''; } } post.render(); }); } } }, pinterest: { posts: [], loaded: false, apiv1: 'https://api.pinterest.com/v1/', getData: function(account) { var request_url, limit = 'limit=' + options.pinterest.limit, fields = 'fields=id,created_at,link,note,creator(url,first_name,last_name,image),image', query_extention = fields + '&access_token=' + options.pinterest.access_token + '&' + limit + '&callback=?'; switch (account[0]) { case '@': var username = account.substr(1); if (username === 'me') { request_url = Feed.pinterest.apiv1 + 'me/pins/?' + query_extention; } else { request_url = Feed.pinterest.apiv1 + 'boards/' + username + '/pins?' + query_extention; } break; default: } Utility.request(request_url, Feed.pinterest.utility.getPosts); }, utility: { getPosts: function(json) { json.data.forEach(function(element) { var post = new SocialFeedPost('pinterest', Feed.pinterest.utility.unifyPostData(element)); post.render(); }); }, unifyPostData: function(element){ var post = {}; post.id = element.id; post.dt_create= moment(element.created_at); post.author_link = element.creator.url; post.author_picture = element.creator.image['60x60' ].url; post.author_name = element.creator.first_name + element.creator.last_name; post.message = element.note; post.description = ''; post.social_network = 'pinterest'; post.link = element.link ? element.link : 'https://www.pinterest.com/pin/' + element.id; if (options.show_media) { post.attachment = ''; } return post; } } }, rss : { posts: [], loaded: false, api : 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0', getData: function(url) { var limit = '&num='+ options.rss.limit, request_url = Feed.rss.api + limit + '&q=' + encodeURIComponent(url); Utility.request(request_url, Feed.rss.utility.getPosts); }, utility: { getPosts: function(json) { $.each(json.responseData.feed.entries, function(index, element) { var post = new SocialFeedPost('rss', Feed.rss.utility.unifyPostData(index, element)); post.render(); }); }, unifyPostData: function(index, element){ var post = {}; post.id = index; post.dt_create= moment(element.publishedDate, 'ddd, DD MMM YYYY HH:mm:ss ZZ', 'en'); post.author_link = ''; post.author_picture = ''; post.author_name = element.author; post.message = Utility.stripHTML(element.title); post.description = Utility.stripHTML(element.content); post.social_network = 'rss'; post.link = element.link; if (options.show_media && element.mediaGroups ) { post.attachment = ''; } return post; } } } }; //make the plugin chainable return this.each(function() { // Initialization Feed.init(); if (options.update_period) { setInterval(function() { return Feed.init(); }, options.update_period); } }) }; })(jQuery); // source --> https://www.responsenet.org/wp-content/themes/layerswp/assets/js/plugins.js?ver=2.0.10 /*! * imagesLoaded PACKAGED v3.1.8 * JavaScript is all like "You images are done yet or what?" * MIT License */ (function () { /** * Class for managing events. * Can be extended to provide event functionality in other classes. * * @class EventEmitter Manages event registering and emitting. */ function EventEmitter() {} // Shortcuts to improve speed and size var proto = EventEmitter.prototype; var exports = this; var originalGlobalValue = exports.EventEmitter; /** * Finds the index of the listener for the event in it's storage array. * * @param {Function[]} listeners Array of listeners to search through. * @param {Function} listener Method to look for. * @return {Number} Index of the specified listener, -1 if not found * @api private */ function indexOfListener(listeners, listener) { var i = listeners.length; while (i--) { if (listeners[i].listener === listener) { return i; } } return -1; } /** * Alias a method while keeping the context correct, to allow for overwriting of target method. * * @param {String} name The name of the target method. * @return {Function} The aliased method * @api private */ function alias(name) { return function aliasClosure() { return this[name].apply(this, arguments); }; } /** * Returns the listener array for the specified event. * Will initialise the event object and listener arrays if required. * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. * Each property in the object response is an array of listener functions. * * @param {String|RegExp} evt Name of the event to return the listeners from. * @return {Function[]|Object} All listener functions for the event. */ proto.getListeners = function getListeners(evt) { var events = this._getEvents(); var response; var key; // Return a concatenated array of all matching events if // the selector is a regular expression. if (typeof evt === 'object') { response = {}; for (key in events) { if (events.hasOwnProperty(key) && evt.test(key)) { response[key] = events[key]; } } } else { response = events[evt] || (events[evt] = []); } return response; }; /** * Takes a list of listener objects and flattens it into a list of listener functions. * * @param {Object[]} listeners Raw listener objects. * @return {Function[]} Just the listener functions. */ proto.flattenListeners = function flattenListeners(listeners) { var flatListeners = []; var i; for (i = 0; i < listeners.length; i += 1) { flatListeners.push(listeners[i].listener); } return flatListeners; }; /** * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. * * @param {String|RegExp} evt Name of the event to return the listeners from. * @return {Object} All listener functions for an event in an object. */ proto.getListenersAsObject = function getListenersAsObject(evt) { var listeners = this.getListeners(evt); var response; if (listeners instanceof Array) { response = {}; response[evt] = listeners; } return response || listeners; }; /** * Adds a listener function to the specified event. * The listener will not be added if it is a duplicate. * If the listener returns true then it will be removed after it is called. * If you pass a regular expression as the event name then the listener will be added to all events that match it. * * @param {String|RegExp} evt Name of the event to attach the listener to. * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addListener = function addListener(evt, listener) { var listeners = this.getListenersAsObject(evt); var listenerIsWrapped = typeof listener === 'object'; var key; for (key in listeners) { if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { listeners[key].push(listenerIsWrapped ? listener : { listener: listener, once: false }); } } return this; }; /** * Alias of addListener */ proto.on = alias('addListener'); /** * Semi-alias of addListener. It will add a listener that will be * automatically removed after it's first execution. * * @param {String|RegExp} evt Name of the event to attach the listener to. * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addOnceListener = function addOnceListener(evt, listener) { return this.addListener(evt, { listener: listener, once: true }); }; /** * Alias of addOnceListener. */ proto.once = alias('addOnceListener'); /** * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. * You need to tell it what event names should be matched by a regex. * * @param {String} evt Name of the event to create. * @return {Object} Current instance of EventEmitter for chaining. */ proto.defineEvent = function defineEvent(evt) { this.getListeners(evt); return this; }; /** * Uses defineEvent to define multiple events. * * @param {String[]} evts An array of event names to define. * @return {Object} Current instance of EventEmitter for chaining. */ proto.defineEvents = function defineEvents(evts) { for (var i = 0; i < evts.length; i += 1) { this.defineEvent(evts[i]); } return this; }; /** * Removes a listener function from the specified event. * When passed a regular expression as the event name, it will remove the listener from all events that match it. * * @param {String|RegExp} evt Name of the event to remove the listener from. * @param {Function} listener Method to remove from the event. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeListener = function removeListener(evt, listener) { var listeners = this.getListenersAsObject(evt); var index; var key; for (key in listeners) { if (listeners.hasOwnProperty(key)) { index = indexOfListener(listeners[key], listener); if (index !== -1) { listeners[key].splice(index, 1); } } } return this; }; /** * Alias of removeListener */ proto.off = alias('removeListener'); /** * Adds listeners in bulk using the manipulateListeners method. * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. * You can also pass it a regular expression to add the array of listeners to all events that match it. * Yeah, this function does quite a bit. That's probably a bad thing. * * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to add. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addListeners = function addListeners(evt, listeners) { // Pass through to manipulateListeners return this.manipulateListeners(false, evt, listeners); }; /** * Removes listeners in bulk using the manipulateListeners method. * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. * You can also pass it an event name and an array of listeners to be removed. * You can also pass it a regular expression to remove the listeners from all events that match it. * * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to remove. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeListeners = function removeListeners(evt, listeners) { // Pass through to manipulateListeners return this.manipulateListeners(true, evt, listeners); }; /** * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. * The first argument will determine if the listeners are removed (true) or added (false). * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. * You can also pass it an event name and an array of listeners to be added/removed. * You can also pass it a regular expression to manipulate the listeners of all events that match it. * * @param {Boolean} remove True if you want to remove listeners, false if you want to add. * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to add/remove. * @return {Object} Current instance of EventEmitter for chaining. */ proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { var i; var value; var single = remove ? this.removeListener : this.addListener; var multiple = remove ? this.removeListeners : this.addListeners; // If evt is an object then pass each of it's properties to this method if (typeof evt === 'object' && !(evt instanceof RegExp)) { for (i in evt) { if (evt.hasOwnProperty(i) && (value = evt[i])) { // Pass the single listener straight through to the singular method if (typeof value === 'function') { single.call(this, i, value); } else { // Otherwise pass back to the multiple function multiple.call(this, i, value); } } } } else { // So evt must be a string // And listeners must be an array of listeners // Loop over it and pass each one to the multiple method i = listeners.length; while (i--) { single.call(this, evt, listeners[i]); } } return this; }; /** * Removes all listeners from a specified event. * If you do not specify an event then all listeners will be removed. * That means every event will be emptied. * You can also pass a regex to remove all events that match it. * * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeEvent = function removeEvent(evt) { var type = typeof evt; var events = this._getEvents(); var key; // Remove different things depending on the state of evt if (type === 'string') { // Remove all listeners for the specified event delete events[evt]; } else if (type === 'object') { // Remove all events matching the regex. for (key in events) { if (events.hasOwnProperty(key) && evt.test(key)) { delete events[key]; } } } else { // Remove all listeners in all events delete this._events; } return this; }; /** * Alias of removeEvent. * * Added to mirror the node API. */ proto.removeAllListeners = alias('removeEvent'); /** * Emits an event of your choice. * When emitted, every listener attached to that event will be executed. * If you pass the optional argument array then those arguments will be passed to every listener upon execution. * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. * So they will not arrive within the array on the other side, they will be separate. * You can also pass a regular expression to emit to all events that match it. * * @param {String|RegExp} evt Name of the event to emit and execute listeners for. * @param {Array} [args] Optional array of arguments to be passed to each listener. * @return {Object} Current instance of EventEmitter for chaining. */ proto.emitEvent = function emitEvent(evt, args) { var listeners = this.getListenersAsObject(evt); var listener; var i; var key; var response; for (key in listeners) { if (listeners.hasOwnProperty(key)) { i = listeners[key].length; while (i--) { // If the listener returns true then it shall be removed from the event // The function is executed either with a basic call or an apply if there is an args array listener = listeners[key][i]; if (listener.once === true) { this.removeListener(evt, listener.listener); } response = listener.listener.apply(this, args || []); if (response === this._getOnceReturnValue()) { this.removeListener(evt, listener.listener); } } } } return this; }; /** * Alias of emitEvent */ proto.trigger = alias('emitEvent'); /** * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. * * @param {String|RegExp} evt Name of the event to emit and execute listeners for. * @param {...*} Optional additional arguments to be passed to each listener. * @return {Object} Current instance of EventEmitter for chaining. */ proto.emit = function emit(evt) { var args = Array.prototype.slice.call(arguments, 1); return this.emitEvent(evt, args); }; /** * Sets the current value to check against when executing listeners. If a * listeners return value matches the one set here then it will be removed * after execution. This value defaults to true. * * @param {*} value The new value to check for when executing listeners. * @return {Object} Current instance of EventEmitter for chaining. */ proto.setOnceReturnValue = function setOnceReturnValue(value) { this._onceReturnValue = value; return this; }; /** * Fetches the current value to check against when executing listeners. If * the listeners return value matches this one then it should be removed * automatically. It will return true by default. * * @return {*|Boolean} The current value to check for or the default, true. * @api private */ proto._getOnceReturnValue = function _getOnceReturnValue() { if (this.hasOwnProperty('_onceReturnValue')) { return this._onceReturnValue; } else { return true; } }; /** * Fetches the events object and creates one if required. * * @return {Object} The events storage object. * @api private */ proto._getEvents = function _getEvents() { return this._events || (this._events = {}); }; /** * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. * * @return {Function} Non conflicting EventEmitter class. */ EventEmitter.noConflict = function noConflict() { exports.EventEmitter = originalGlobalValue; return EventEmitter; }; // Expose the class either via AMD, CommonJS or the global object if (typeof define === 'function' && define.amd) { define('eventEmitter/EventEmitter',[],function () { return EventEmitter; }); } else if (typeof module === 'object' && module.exports){ module.exports = EventEmitter; } else { this.EventEmitter = EventEmitter; } }.call(this)); /*! * eventie v1.0.4 * event binding helper * eventie.bind( elem, 'click', myFn ) * eventie.unbind( elem, 'click', myFn ) */ /*jshint browser: true, undef: true, unused: true */ /*global define: false */ ( function( window ) { var docElem = document.documentElement; var bind = function() {}; function getIEEvent( obj ) { var event = window.event; // add event.target event.target = event.target || event.srcElement || obj; return event; } if ( docElem.addEventListener ) { bind = function( obj, type, fn ) { obj.addEventListener( type, fn, false ); }; } else if ( docElem.attachEvent ) { bind = function( obj, type, fn ) { obj[ type + fn ] = fn.handleEvent ? function() { var event = getIEEvent( obj ); fn.handleEvent.call( fn, event ); } : function() { var event = getIEEvent( obj ); fn.call( obj, event ); }; obj.attachEvent( "on" + type, obj[ type + fn ] ); }; } var unbind = function() {}; if ( docElem.removeEventListener ) { unbind = function( obj, type, fn ) { obj.removeEventListener( type, fn, false ); }; } else if ( docElem.detachEvent ) { unbind = function( obj, type, fn ) { obj.detachEvent( "on" + type, obj[ type + fn ] ); try { delete obj[ type + fn ]; } catch ( err ) { // can't delete window object properties obj[ type + fn ] = undefined; } }; } var eventie = { bind: bind, unbind: unbind }; // transport if ( typeof define === 'function' && define.amd ) { // AMD define( 'eventie/eventie',eventie ); } else { // browser global window.eventie = eventie; } })( this ); /*! * imagesLoaded v3.1.8 * JavaScript is all like "You images are done yet or what?" * MIT License */ ( function( window, factory ) { // universal module definition /*global define: false, module: false, require: false */ if ( typeof define === 'function' && define.amd ) { // AMD define( [ 'eventEmitter/EventEmitter', 'eventie/eventie' ], function( EventEmitter, eventie ) { return factory( window, EventEmitter, eventie ); }); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = factory( window, require('wolfy87-eventemitter'), require('eventie') ); } else { // browser global window.imagesLoaded = factory( window, window.EventEmitter, window.eventie ); } })( window, // -------------------------- factory -------------------------- // function factory( window, EventEmitter, eventie ) { var $ = window.jQuery; var console = window.console; var hasConsole = typeof console !== 'undefined'; // -------------------------- helpers -------------------------- // // extend objects function extend( a, b ) { for ( var prop in b ) { a[ prop ] = b[ prop ]; } return a; } var objToString = Object.prototype.toString; function isArray( obj ) { return objToString.call( obj ) === '[object Array]'; } // turn element or nodeList into an array function makeArray( obj ) { var ary = []; if ( isArray( obj ) ) { // use object if already an array ary = obj; } else if ( typeof obj.length === 'number' ) { // convert nodeList to array for ( var i=0, len = obj.length; i < len; i++ ) { ary.push( obj[i] ); } } else { // array of single index ary.push( obj ); } return ary; } // -------------------------- imagesLoaded -------------------------- // /** * @param {Array, Element, NodeList, String} elem * @param {Object or Function} options - if function, use as callback * @param {Function} onAlways - callback function */ function ImagesLoaded( elem, options, onAlways ) { // coerce ImagesLoaded() without new, to be new ImagesLoaded() if ( !( this instanceof ImagesLoaded ) ) { return new ImagesLoaded( elem, options ); } // use elem as selector string if ( typeof elem === 'string' ) { elem = document.querySelectorAll( elem ); } this.elements = makeArray( elem ); this.options = extend( {}, this.options ); if ( typeof options === 'function' ) { onAlways = options; } else { extend( this.options, options ); } if ( onAlways ) { this.on( 'always', onAlways ); } this.getImages(); if ( $ ) { // add jQuery Deferred object this.jqDeferred = new $.Deferred(); } // HACK check async to allow time to bind listeners var _this = this; setTimeout( function() { _this.check(); }); } ImagesLoaded.prototype = new EventEmitter(); ImagesLoaded.prototype.options = {}; ImagesLoaded.prototype.getImages = function() { this.images = []; // filter & find items if we have an item selector for ( var i=0, len = this.elements.length; i < len; i++ ) { var elem = this.elements[i]; // filter siblings if ( elem.nodeName === 'IMG' ) { this.addImage( elem ); } // find children // no non-element nodes, #143 var nodeType = elem.nodeType; if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { continue; } var childElems = elem.querySelectorAll('img'); // concat childElems to filterFound array for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { var img = childElems[j]; this.addImage( img ); } } }; /** * @param {Image} img */ ImagesLoaded.prototype.addImage = function( img ) { var loadingImage = new LoadingImage( img ); this.images.push( loadingImage ); }; ImagesLoaded.prototype.check = function() { var _this = this; var checkedCount = 0; var length = this.images.length; this.hasAnyBroken = false; // complete if no images if ( !length ) { this.complete(); return; } function onConfirm( image, message ) { if ( _this.options.debug && hasConsole ) { console.log( 'confirm', image, message ); } _this.progress( image ); checkedCount++; if ( checkedCount === length ) { _this.complete(); } return true; // bind once } for ( var i=0; i < length; i++ ) { var loadingImage = this.images[i]; loadingImage.on( 'confirm', onConfirm ); loadingImage.check(); } }; ImagesLoaded.prototype.progress = function( image ) { this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; // HACK - Chrome triggers event before object properties have changed. #83 var _this = this; setTimeout( function() { _this.emit( 'progress', _this, image ); if ( _this.jqDeferred && _this.jqDeferred.notify ) { _this.jqDeferred.notify( _this, image ); } }); }; ImagesLoaded.prototype.complete = function() { var eventName = this.hasAnyBroken ? 'fail' : 'done'; this.isComplete = true; var _this = this; // HACK - another setTimeout so that confirm happens after progress setTimeout( function() { _this.emit( eventName, _this ); _this.emit( 'always', _this ); if ( _this.jqDeferred ) { var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; _this.jqDeferred[ jqMethod ]( _this ); } }); }; // -------------------------- jquery -------------------------- // if ( $ ) { $.fn.imagesLoaded = function( options, callback ) { var instance = new ImagesLoaded( this, options, callback ); return instance.jqDeferred.promise( $(this) ); }; } // -------------------------- -------------------------- // function LoadingImage( img ) { this.img = img; } LoadingImage.prototype = new EventEmitter(); LoadingImage.prototype.check = function() { // first check cached any previous images that have same src var resource = cache[ this.img.src ] || new Resource( this.img.src ); if ( resource.isConfirmed ) { this.confirm( resource.isLoaded, 'cached was confirmed' ); return; } // If complete is true and browser supports natural sizes, // try to check for image status manually. if ( this.img.complete && this.img.naturalWidth !== undefined ) { // report based on naturalWidth this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); return; } // If none of the checks above matched, simulate loading on detached element. var _this = this; resource.on( 'confirm', function( resrc, message ) { _this.confirm( resrc.isLoaded, message ); return true; }); resource.check(); }; LoadingImage.prototype.confirm = function( isLoaded, message ) { this.isLoaded = isLoaded; this.emit( 'confirm', this, message ); }; // -------------------------- Resource -------------------------- // // Resource checks each src, only once // separate class from LoadingImage to prevent memory leaks. See #115 var cache = {}; function Resource( src ) { this.src = src; // add to cache cache[ src ] = this; } Resource.prototype = new EventEmitter(); Resource.prototype.check = function() { // only trigger checking once if ( this.isChecked ) { return; } // simulate loading on detached element var proxyImage = new Image(); eventie.bind( proxyImage, 'load', this ); eventie.bind( proxyImage, 'error', this ); proxyImage.src = this.src; // set flag this.isChecked = true; }; // ----- events ----- // // trigger specified handler for event type Resource.prototype.handleEvent = function( event ) { var method = 'on' + event.type; if ( this[ method ] ) { this[ method ]( event ); } }; Resource.prototype.onload = function( event ) { this.confirm( true, 'onload' ); this.unbindProxyEvents( event ); }; Resource.prototype.onerror = function( event ) { this.confirm( false, 'onerror' ); this.unbindProxyEvents( event ); }; // ----- confirm ----- // Resource.prototype.confirm = function( isLoaded, message ) { this.isConfirmed = true; this.isLoaded = isLoaded; this.emit( 'confirm', this, message ); }; Resource.prototype.unbindProxyEvents = function( event ) { eventie.unbind( event.target, 'load', this ); eventie.unbind( event.target, 'error', this ); }; // ----- ----- // return ImagesLoaded; }); /*global jQuery */ /*jshint browser:true */ /*! * FitVids 1.1 * * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ * */ ;(function( $ ){ 'use strict'; $.fn.fitVids = function( options ) { var settings = { customSelector: null, ignore: null }; if(!document.getElementById('fit-vids-style')) { // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js var head = document.head || document.getElementsByTagName('head')[0]; var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; var div = document.createElement("div"); div.innerHTML = '

      x

      '; head.appendChild(div.childNodes[1]); } if ( options ) { $.extend( settings, options ); } return this.each(function(){ var selectors = [ 'iframe[src*="player.vimeo.com"]', 'iframe[src*="youtube.com"]', 'iframe[src*="youtube-nocookie.com"]', 'iframe[src*="kickstarter.com"][src*="video.html"]', 'object', 'embed' ]; if (settings.customSelector) { selectors.push(settings.customSelector); } var ignoreList = '.fitvidsignore'; if(settings.ignore) { ignoreList = ignoreList + ', ' + settings.ignore; } var $allVideos = $(this).find(selectors.join(',')); $allVideos = $allVideos.not('object object'); // SwfObj conflict patch $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. $allVideos.each(function(count){ var $this = $(this); if($this.parents(ignoreList).length > 0) { return; // Disable FitVids on this video. } if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) { $this.attr('height', 9); $this.attr('width', 16); } var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), aspectRatio = height / width; if(!$this.attr('id')){ var videoID = 'fitvid' + count; $this.attr('id', videoID); } $this.wrap('
      ').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); $this.removeAttr('height').removeAttr('width'); }); }); }; // Works with either jQuery or Zepto })( window.jQuery || window.Zepto ); /* Sticky-kit v1.1.1 | WTFPL | Leaf Corcoran 2014 | http://leafo.net */ (function(){var k,e;k=this.jQuery||window.jQuery;e=k(window);k.fn.stick_in_parent=function(d){var v,y,n,p,h,C,s,G,q,H;null==d&&(d={});s=d.sticky_class;y=d.inner_scrolling;C=d.recalc_every;h=d.parent;p=d.offset_top;n=d.spacer;v=d.bottoming;null==p&&(p=0);null==h&&(h=void 0);null==y&&(y=!0);null==s&&(s="is_stuck");null==v&&(v=!0);G=function(a,d,q,z,D,t,r,E){var u,F,m,A,c,f,B,w,x,g,b;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);f=a.parent();null!=h&&(f=f.closest(h));if(!f.length)throw"failed to find stick parent"; u=m=!1;(g=null!=n?n&&a.closest(n):k("
      "))&&g.css("position",a.css("position"));B=function(){var c,e,l;if(!E&&(c=parseInt(f.css("border-top-width"),10),e=parseInt(f.css("padding-top"),10),d=parseInt(f.css("padding-bottom"),10),q=f.offset().top+c+e,z=f.height(),m&&(u=m=!1,null==n&&(a.insertAfter(g),g.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(s),l=!0),D=a.offset().top-parseInt(a.css("margin-top"),10)-p,t=a.outerHeight(!0),r=a.css("float"),g&&g.css({width:a.outerWidth(!0), height:t,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),l))return b()};B();if(t!==z)return A=void 0,c=p,x=C,b=function(){var b,k,l,h;if(!E&&(null!=x&&(--x,0>=x&&(x=C,B())),l=e.scrollTop(),null!=A&&(k=l-A),A=l,m?(v&&(h=l+t+c>z+q,u&&!h&&(u=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),lb&&!u&&(c-=k,c=Math.max(b-t,c),c=Math.min(p,c),m&&a.css({top:c+"px"})))):l>D&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(s),null==n&&(a.after(g),"left"!==r&&"right"!==r||g.append(a)),a.trigger("sticky_kit:stick")),m&&v&&(null==h&&(h=l+t+c>z+q),!u&&h)))return u=!0,"static"===f.css("position")&&f.css({position:"relative"}),a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")}, w=function(){B();return b()},F=function(){E=!0;e.off("touchmove",b);e.off("scroll",b);e.off("resize",w);k(document.body).off("sticky_kit:recalc",w);a.off("sticky_kit:detach",F);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});f.position("position","");if(m)return null==n&&("left"!==r&&"right"!==r||a.insertAfter(g),g.remove()),a.removeClass(s)},e.on("touchmove",b),e.on("scroll",b),e.on("resize",w),k(document.body).on("sticky_kit:recalc",w),a.on("sticky_kit:detach",F),setTimeout(b, 0)}};q=0;for(H=this.length;qn;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.Context.refreshAll();for(var e in i)i[e].enabled=!0;return this},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,n.windowContext||(n.windowContext=!0,n.windowContext=new e(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),i=this.element==this.element.window;t&&e&&!i&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s];if(null!==a.triggerPoint){var l=o.oldScroll=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=Math.floor(y+l-f),h=w=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();